Hey People, I''ve been working on Rails 3.0.0 and Authlogic for quite a while now but all of a sudden I can''t login into my application anymore. After some research I found out that no sessions are stored into the db anymore so I started the console and saw this: ruby-1.9.2-p0 > u = UserSession.new({:username => ''Test'', :password => ''test123''}) => #<UserSession: {:username=>"Test", :password=>"<protected>"}> ruby-1.9.2-p0 > u.save NoMethodError: undefined method `cookies'' for "UserSession":String from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/authlogic-2.1.6/lib/authlogic/session/cookies.rb:117:in `save_cookie'' from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/callbacks.rb:414:in `_run_after_save_callbacks'' from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/callbacks.rb:93:in `run_callbacks'' from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/authlogic-2.1.6/lib/authlogic/session/callbacks.rb:87:in `after_save'' from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/authlogic-2.1.6/lib/authlogic/session/existence.rb:71:in `save'' from (irb):19 from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/lib/rails/commands/console.rb:44:in `start'' from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/lib/rails/commands/console.rb:8:in `start'' from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/lib/rails/commands.rb:23:in `<top (required)>'' from script/rails:6:in `require'' from script/rails:6:in `<main>'' To be honest I have no idea why this happens all of a sudden. Anyone ran into the same problem? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Apparently, this part of the code causes the trouble: def save_cookie controller.cookies[cookie_key] = { :value => "#{record.persistence_token}::#{record.send(record.class.primary_key)}", :expires => remember_me_until, :domain => controller.cookie_domain } end For some reason the "controller" variable is only a String. Couldn''t find where it''s set but yeah... it''s a bit too deep in the Gem code so I guess I need to switch to another authentification gem until this is solved. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 2 December 2010 16:49, Heinz Strunk <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Apparently, this part of the code causes the trouble: > def save_cookie > controller.cookies[cookie_key] = { > :value => > "#{record.persistence_token}::#{record.send(record.class.primary_key)}", > :expires => remember_me_until, > :domain => controller.cookie_domain > } > end > > For some reason the "controller" variable is only a String. Couldn''t > find where it''s set but yeah... it''s a bit too deep in the Gem code so I > guess I need to switch to another authentification gem until this is > solved.Can''t you roll back in your source control system to a version that worked and determine the cause of the problem that way? Or do you think it was a change in your system (gem upgrade or whatever) that caused the problem to appear. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Heinz Strunk
2010-Dec-03 12:42 UTC
Re: Re: Rails 3 + Authlogic not working all of a sudden
Colin Law wrote in post #965721:> > Can''t you roll back in your source control system to a version that > worked and determine the cause of the problem that way? Or do you > think it was a change in your system (gem upgrade or whatever) that > caused the problem to appear. > > ColinI did a rollback already but that didn''t help. So it can only have something to do with the gems even though I have only one version of Authlogic installed: authlogic (2.1.6) Any suggestions? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Removed and reinstalled all gems. Same... getting a bit desperate now. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I have the same issue, except instead of a string, it''s an object: NoMethodError: undefined method `cookies'' for main:Object from /Library/Ruby/Gems/1.8/gems/authlogic-2.1.6/lib/authlogic/controller_adapters/rails_adapter.rb:13:in `send'' from /Library/Ruby/Gems/1.8/gems/authlogic-2.1.6/lib/authlogic/controller_adapters/rails_adapter.rb:13:in `cookies'' from /Library/Ruby/Gems/1.8/gems/authlogic-2.1.6/lib/authlogic/session/cookies.rb:117:in `save_cookie'' from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/callbacks.rb:414:in `_run_after_save_callbacks'' from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/callbacks.rb:93:in `send'' from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/callbacks.rb:93:in `run_callbacks'' from /Library/Ruby/Gems/1.8/gems/authlogic-2.1.6/lib/authlogic/session/callbacks.rb:83:in `after_save'' from /Library/Ruby/Gems/1.8/gems/authlogic-2.1.6/lib/authlogic/session/existence.rb:71:in `save'' from (irb):10 Going to report as 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi Heinz, I''ve created a simple authlogic3 rails template that might help you get started. It basically creates and does everything for you, including creating the models. https://github.com/davidchua/authlogic-rails3-template I don''t know if its useful, but it might be a good alternative if you''re still stuck. Warmest regards, David On Mon, Dec 6, 2010 at 4:44 AM, Heinz Strunk <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Removed and reinstalled all gems. Same... getting a bit desperate now. > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Heinz Strunk
2011-Feb-09 19:13 UTC
Re: Re: Rails 3 + Authlogic not working all of a sudden
My problem disappeared after some weeks of ignoring it, still no freaking idea what caused it and what made it disappear again but your template looks very interesting. Will give it a try once it''s back :) -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Reasonably Related Threads
- Problem testing Authlogic UserSession
- Authlogic: Trying to login in my Cucumber test - Authlogic::Session::Activation::NotActivatedError
- Authlogic + Rails3 - undefined method `Login' for nil:NilClass
- paperclip, authlogic and callback issue
- Authlogic and rails 3 : NameError in User sessionsController#new