No flash messages
It seems that flash messages are gone now that I've upgraded to 1.0.3 version. It is not related to keys of flash messages, because when I try to inspect flash I get empty hash. When I set flash message directly it works.
Are you sure you have the gem responders 0.4.2 or 0.4.3 installed? Can you try to isolate this issue in a fresh app?
I am having the exact same problem, but only in my cucumber steps, not when viewing the site in my browser. Additionally, it's only failing for some of my models, not all of them. It was working fine last night and I did not update any gems on my system. I switched git branches and made a few changes to my CSS, switched back to my master branch, and that's when I started encountering errors.
Are you trying to use flash.now? Or just flash? More info here:
http://groups.google.com/group/inherited_resources/browse_thread/thread/fe6883d5aed98c02
I was using flash[:notice], and then I would do flash.delete[:notice]. I wili check if it is working correctly with setting flash.now
I have the same issue with Rails 3.0.0.beta, inherited 1.1.0, has_scope 0.4.2 and responders 0.5.4.
I tried to debug without success. Any updates?
This is odd guys. Can you try to isolate in a smaller application, so I can debug it?
I'll try to find some time this week to debug this.
Guys, I need a way to reproduce this. Because I definitely can't.
I will create a fresh app tonight to reproduce this ;)
I believe that the problem is in responders. I had the same problem which I managed to get around by switching the lines in to_html so that set_flash_message comes before super.
def to_html
set_flash_message! if set_flash_message?
super
end
To me, it sounds more logical that the flash message should be set before the view is being rendered.
Yeah, it makes sense. So you were all using flash.now?
I was using standard flash, or rather, I let inherited_resources handle everything.
It would be nice to have it use flash.now on failure, but it would probably require a bit more logic for that seeing that giving the :flash_now in the respond_with call would trigger it for both success and failure.
Funny, this should not happen with standard flash.
Well, what I meant was that the flash message did show up after a redirect, but when rendering instead (like in case of an validation error) it never showed up.
I did assume that was what this issue was about since that was what I had problems with, and it seemed similar.
However, it is not using flash.now now since the message is still available for the next action as well. Maybe adding a flag @use_flash_now_on_failure would help me in that case, but I don't think that have anything to do with this issue :)
Inherited Resources forwards all options to respond_with, so you can do:
def create
create!(:flash_now => true)
end
What I can do to support is:
def create
create!(:flash_now => :on_failure)
end
I will work on it.
FIXED. Install new responders please. :D