Using Rails 3.0.3 in combination with gems like devise I don't get any flash messages. Now I mention devise, because it controls the cookies used to authenticate me.
Now the Rails application is a bit special since its using sub-domains. What they do is tell the application which company a user is browsing. An example: mycompany.theapp.com/projects/3/ <- Project 3 of company "mycompany".
When a user logs in he/she is directed to theapp.com/overview <- non subdomain
Every notice there does show, so why not on sub-domain pages?
So this is the code used on sub-domain pages. Exactly the same as one would put it on non-sub-domain pages. The code in the controller:
def update
redirect_to [@project], :notice => "Project #{@project.name} updated."
end
The layouts/application.html.erb
<% flash.each do |type, message| %>
<%= content_tag :div, message, :class => "flash #{type}" %>
<% end %>
I also added the following, trying to figure out what is happening:
flash.to_yaml
# Result: --- !map:ActionDispatch::Flash::FlashHash {}
Since apparently devise uses flash[:notice] I also tried that (because that was working for devise).
flash[:notice] = "Project #{@project.name} updated."
# Result: --- !map:ActionDispatch::Flash::FlashHash {}
Now do the notices get send by cookies or session data that isn't transferred well to sub-domains? Because the edit form of the project is on mycompany.theapp.com/projects/3/edit/
And it sends me to
mycompany.theapp.com/projects/3/ (without notice)
It happens on Ubuntu 10.10 with "rails server", passenger using nginx and even on a Mac machine (but someone else tested that).
Anyone care to guess?