Flash not cleared with ActiveRecord session store


#1

Cheers,

I’ve stumbled over a bug with 1.0 and ActiveRecord store for session
while migrating from pstore sessions.

I created the table with rake create_sessions_table and set
config.action_controller.session_store = :active_record_store in
environment.rb.

Everything runs fine except that the flash messages will not be cleared.
I get the same message everytime on everypage I surf. E.g. if the
message is set through an update action I will see it from now on
forever (or until the controler sets a new one, than this one will get
displayed on every page).

When I change back to pstore (through editing environment.rb),
everything works fine again.

I confirmed this behaviour with my project on FreeBSD 6.0 and MacOSX
10.4 with MySQL 4/5.

Anybody also seeing this or not having trouble with flash and
ActiveRecord session store?

I have the login_engine installed and therefore have to display my flash
messages like this:

<% for name in [:notice, :warning, :message] %>
<% if flash[name] %>
<%= “<div id=“flash” class=“flash” >#{flash[name]}” %>
<% end %>
<% end %>

Jonathan


#2

Jonathan W. wrote:

Cheers,

I’ve stumbled over a bug with 1.0 and ActiveRecord store for session
while migrating from pstore sessions.

I narrowed it down to render_component calls in the layout:

<%= render_component(:controller => “region”, :action => “stats”)%>

I use this for my sidebar and if I comment this out, everything is fine
again.

Disabling sessions in the called controller does not help.

With pstore sessions, everything is fine, this problem exists only with
ActiveRecord store.

Jonathan


#3

This bug is also apparent in a new project.

Just create a new rails project and insert a render_component call in
your layout. When you use ActiveRecord Session Store, the flash value
will never be cleared.

Jonathan


Jonathan W.
http://blog.innerewut.de


#4

Jonathan W. wrote:

This bug is also apparent in a new project.

Just create a new rails project and insert a render_component call in
your layout. When you use ActiveRecord Session Store, the flash value
will never be cleared.

Jonathan

I think this problem will be fixed with this patch:
http://dev.rubyonrails.org/ticket/3527

– stefan


For rails performance tuning, see: http://railsexpress.de/blog
Subscription: http://railsexpress.de/blog/xml/rss20/feed.xml


#5

Stefan K. wrote:

I think this problem will be fixed with this patch:
http://dev.rubyonrails.org/ticket/3527

Yes this fixes the problem! It also should close
http://dev.rubyonrails.org/ticket/3194

– stefan

Jonathan