flash

Should flash still be persisting through redirects? Until the recent release, when I had:

flash[:error] = "Foo" redirect_to login_url

The flash would be populated and displayed on the login page. Now the flash is being cleared. Is this intentional, and if so why?

Are you sure there’s not a double redirect? This can happen if you’re using a plugin like ssl_requirement, where the initial redirect to login_path goes to port 80, then the plugin jumps in and redirects to the same url on port 443.

-John

We are only using ssl. It worked before the last upgrade. I can't find a double redirect.

Should flash still be persisting through redirects? Until the recent release, when I had:

flash[:error] = "Foo" redirect_to login_url

The flash would be populated and displayed on the login page. Now the flash is being cleared. Is this intentional, and if so why?

No, and this works for me at present. As John mentioned, the double redirect is the likely cause. What do your logs show?

I'l have to find it. The team changed it to a render instead of a redirect(as a temp fix) I have to change it back to tell you. We really hacked it. I had redirect_to :index and now it is:

#update_code index render :index #failed update code

Horrible!

I'll get on changing it back and let you know.

err render(redirect_to) :action=> 'index' sorry

It is a single redirect. Here is the log.

Processing User::MemberInfoController#index (for 127.0.0.1 at 2009-04-28 09:44:23) [GET]   Parameters: {"action"=>"index", "controller"=>"user/member_info"}   Member Load (12.4ms) SELECT * FROM `member` WHERE (`member`.`username` = 'factoryusername1') LIMIT 1   MemberAvatar Load (0.2ms) SELECT * FROM `member_avatars` WHERE (`member_avatars`.member_id = 'id1') LIMIT 1 Rendering template within layouts/main Rendering user/member_info/index Rendered user/member_info/_form (8.1ms) Rendered user/member_info/_avatar (3.6ms)   Skill Load (0.3ms) SELECT * FROM `skills` WHERE (`skills`.member_id = 'id1') Rendered user/member_info/_skill_summary (93.3ms) Rendered user/member_info/_password_form (4.0ms) Rendered layouts/_doctype (0.1ms) Rendered shared/_welcome (0.1ms) Rendered layouts/_navigation (0.4ms) Rendered layouts/_header (0.9ms) Rendered layouts/_error_section (0.2ms)   SiteLink Load (0.4ms) SELECT * FROM `customlink` WHERE ( (`customlink`.`type` = 'SiteLink' ) )   SQL (0.3ms) SELECT count(*) AS count_all FROM `memberproject` WHERE (((`memberproject`.`status` = 'ACT') AND (`memberproject`.memberid = 'id1')) AND (`memberproject`.memberid = 'id1')) LIMIT 6 Rendered layouts/_page_footer (4.3ms) Rendered layouts/_navigation (0.3ms) Rendered layouts/_footer (0.6ms) Completed in 137ms (View: 121, DB: 14) | 200 OK [http://www.example.com/user/member_info\] REQUESTING PAGE: POST /user/member_info/updatePass with {"commit"=>"Change Password", "password_confirmation"=>["111111"], "memberid"=>["id1"], "new_password"=>["111111"], "password"=>["111111"]} and HTTP headers {"HTTP_REFERER"=>"/user/member_info"}

Processing User::MemberInfoController#updatePass (for 127.0.0.1 at 2009-04-28 09:44:24) [POST]   Parameters: {"commit"=>"Change Password", "password_confirmation"=>"[FILTERED]", "memberid"=>["id1"], "action"=>"updatePass", "controller"=>"user/member_info", "new_password"=>"[FILTERED]", "password"=>"[FILTERED]"}   Member Load (12.3ms) SELECT * FROM `member` WHERE (`member`.`username` = 'factoryusername1') LIMIT 1   Member Load (1.5ms) SELECT * FROM `member` WHERE (`member`.`memberid` IN ('id1')) LIMIT 1 Redirected to http://www.example.com/user/member_info Completed in 17ms (DB: 15) | 302 Found [http://www.example.com/user/member_info/updatePass\] REQUESTING PAGE: GET http://www.example.com/user/member_info with {} and HTTP headers {"HTTP_REFERER"=>"/user/member_info/updatePass"}

Processing User::MemberInfoController#index (for 127.0.0.1 at 2009-04-28 09:44:24) [GET]   Parameters: {"action"=>"index", "controller"=>"user/member_info"}   Member Load (1.0ms) SELECT * FROM `member` WHERE (`member`.`username` = 'factoryusername1') LIMIT 1   MemberAvatar Load (0.2ms) SELECT * FROM `member_avatars` WHERE (`member_avatars`.member_id = 'id1') LIMIT 1 Rendering template within layouts/main Rendering user/member_info/index Rendered user/member_info/_form (2.7ms) Rendered user/member_info/_avatar (0.4ms)   Skill Load (0.2ms) SELECT * FROM `skills` WHERE (`skills`.member_id = 'id1') Rendered user/member_info/_skill_summary (1.2ms) Rendered user/member_info/_password_form (0.8ms) Rendered layouts/_doctype (0.1ms) Rendered shared/_welcome (0.1ms) Rendered layouts/_navigation (0.4ms) Rendered layouts/_header (0.8ms) Rendered layouts/_error_section (0.2ms)   SiteLink Load (0.3ms) SELECT * FROM `customlink` WHERE ( (`customlink`.`type` = 'SiteLink' ) )   SQL (0.3ms) SELECT count(*) AS count_all FROM `memberproject` WHERE (((`memberproject`.`status` = 'ACT') AND (`memberproject`.memberid = 'id1')) AND (`memberproject`.memberid = 'id1')) LIMIT 6 Rendered layouts/_page_footer (3.6ms) Rendered layouts/_navigation (0.3ms) Rendered layouts/_footer (0.6ms) Completed in 17ms (View: 13, DB: 3) | 200 OK [http://www.example.com/user/member_info\]   SQL (1.0ms) ROLLBACK

The first action is getting to the page that lists all the information. Then there is an updatePass action the redirects to index. Sorry about the conventions this is an old part of the application and was written before the team had known much about ruby or rails. Right now it is difficult to change because we are interacting with a legacy application that is not well tested.

I'm dealing with this issue as well and as far as I can tell there is only a single redirect. Has anybody figured out the problem?

hey there, I have the same issue here with rails 2.3.2, have you come to some advance with this?

thanks in advance, joaquin

Any chance the entire app is open source on github? I’d take a look around.