2016-07-21 2 views
1

Как мне заставить bootstrap_flash работать? это мой create.js.erbbootstrap_flash с ajax-рельсами

$('.errors').html("<%= j render 'common/errors', resource:@answer %>"); 
$('.answers').append("<%= j render @answer %>"); 
$('.notice_flash'). ????????? I've tryed replaceWith(<%= bootstrap_flash%>) 

это стандартное тонкое от макета

.container 
    .row 
    .col-lg-12 
     .notice_flash     
     = bootstrap_flash 
     = yield  

и контроллера

def create  
@answer = @question.answers.new(answer_params)  
@answer.user = current_user  
flash.now[:notice] = "Successfully created" if @answer.save    

конца

ответ

-1
  1. сделать частичным как вид /shared/_notice.html.slim
  2. в парциальное просто написать

    = bootstrap_flash

  3. в ваш create.js.erb

    .... $ ('notice_flash'). HTML (»<% = у render 'share/noty'%> "); ....

0

В create.js.erb:

$('.notice_flash').html('<%= bootstrap_flash %>')

Смежные вопросы