Hi Until recently it was easy to log in a user in a test case by just passing a parameter in the get method like this: get :show, {:id => posts(:private_post).id}, { :user_id => users(:tesla).id } Now with Ruby 1.8.6 and Rails 1.2.5 that doesn''t work anymore. What has changed? I''ve tried this: session[:user_id] = users(:tesla).id get :show, {:id => posts(:private_post).id} But session[:user_id] is always nil! Thanks, hawe. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 18 Nov 2007, at 11:00, Heiko Webers wrote:> > Hi > > Until recently it was easy to log in a user in a test case by just > passing a parameter in the get method like this: > > get :show, {:id => posts(:private_post).id}, { :user_id => > users(:tesla).id } > > Now with Ruby 1.8.6 and Rails 1.2.5 that doesn''t work anymore. What > has > changed? I''ve tried this: > > session[:user_id] = users(:tesla).id > get :show, {:id => posts(:private_post).id} >I''ve always used @request.session[:foo]=:bar Fred --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> I''ve always used @request.session[:foo]=:barYes, I tried that too, but it looses the session information on the way. Now I found out that it actually works for the action itself (the session value is present), but not for before_filters (the session value went away)! And I can still pass the session information in a hash, as before. So this seems to be a bug? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---