I have stuff with Ruby on Rails 3
I try this simple code
def index
flash[:notice] = "ok"
respond_to do |format|
format.html # index.html.erb
end
end
it does not work
NoMethodError in DashboardsController#index
undefined method `flash' for #<ActionDispatch::Request:0x7fee9329a9d0>
When I try
redirect_to :some_in, :notice => "ok"
in other place (in some_controller.rb) and then print this :notice in .erb I have same error, undefined method `flash'
I'm stuck on this. I used google to search for it but it does not help.
In config/applications.rb of your app add this
config.api_only = false
Please include ActionDispatch::Flash middleware into your config/application.rb file.
config.middleware.use ActionDispatch::Flash
This may help you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With