I am using this library, (https://github.com/CodeSeven/toastr) and I am trying to push my Flash notifications to the javascript function Toastr has provided for me. How do I cal
What I'd recommend is to make a new flash
type for this sort of thing and then render that as JS in your layout.
ApplicationController
def toast(type, text)
flash[:toastr] = { type => text }
end
app/views/layouts/.html.erb
# (or in a partial to be reused in various layouts)
# the
<% end %>
So this way you get all the standard behavior you're used to from the flash
object and you get easy to understand javascript written in your views directly via erb. You may need to add an options hash to the ApplicationController#toast
method so you can do a flash.now[:toastr]
at times, of course. And so on... But this should get you started.