I have a silly question.
I’m stuck on that and i don’t know how to solve it 🙂
I have some basic actions like create and destroy comments. I have added the remote => true attribute.
My actions are rendered with a create.js.haml and a destroy.js.haml.
$(".comments").prepend("#{escape_javascript(render(@comment))}");
$("#comments_box .form #new_comment").get(0).reset();
In my controller i have a
flash[:notice] = 'Comment created'
And I would like to update the flash message into the layout….
Into my layout i have this :
- flash.each do |name, msg|
= content_tag :div, msg, :id => "flash_#{name}"
What would be the nicer way to create or update the flash message from jQuery (View) ?
Thanks 🙂
I solved my problem like that :
In my Layout i added :
The flash partial contains :
And in my js.haml
Thanks 😉