dave dumaresq
2006-Jun-08 15:34 UTC
[Rails] LoginEngine: undefined method `generate_security_token''
Hi there, I''m trying to set up LoginEngine with Rails 1.1.2 on Ruby 1.8.4 on a Windows XP box and the log is reporting: undefined method `generate_security_token'' for #<User:0x39436a0> Rendering user/signup Rendered user/_edit (0.01600) Rendered user/_password (0.01600) Rails appears to be failing on key = @user.generate_security_token in user_controller.rb in the signup method. The offending block is: if @user.save key = @user.generate_security_token url = url_for(:action => ''home'', :user_id => @user.id, :key => key) flash[:notice] = ''Signup successful!'' if LoginEngine.config(:use_email_notification) and LoginEngine.config(:confirm_account) UserNotify.deliver_signup(@user, params[:user][:password], url) flash[:notice] << '' Please check your registered email account to verify your account registration and continue with the login.'' else flash[:notice] << '' Please log in.'' end redirect_to :action => ''login'' end Initially, I also had undefined method errors for password and new_password for #<User...>, so I added these fields to the user table. It seems like the LoginEngine was not correctly installed or at least the migration 001_initial_schema was incomplete. I can work around with that, however, this error truly seems like a missing method. This is my first experience installing an engine. Any help is appreciated! Dave -- Posted via http://www.ruby-forum.com/.
James Adam
2006-Jun-08 16:20 UTC
[Rails] LoginEngine: undefined method `generate_security_token''
Do you have an existing User model in your application? If so, you need to include the AuthenticatedUser model in it, as per the docs... - james On 6/8/06, dave dumaresq <ddumaresq@telus.net> wrote:> Hi there, > > I''m trying to set up LoginEngine with Rails 1.1.2 on Ruby 1.8.4 on a > Windows XP box and the log is reporting: > > undefined method `generate_security_token'' for #<User:0x39436a0> > Rendering user/signup > Rendered user/_edit (0.01600) > Rendered user/_password (0.01600) > > Rails appears to be failing on key = @user.generate_security_token in > user_controller.rb in the signup method. The offending block is: > > if @user.save > key = @user.generate_security_token > url = url_for(:action => ''home'', :user_id => @user.id, :key => > key) > flash[:notice] = ''Signup successful!'' > if LoginEngine.config(:use_email_notification) and > LoginEngine.config(:confirm_account) > UserNotify.deliver_signup(@user, params[:user][:password], > url) > flash[:notice] << '' Please check your registered email > account to verify your account registration and continue with the > login.'' > else > flash[:notice] << '' Please log in.'' > end > redirect_to :action => ''login'' > end > > Initially, I also had undefined method errors for password and > new_password for #<User...>, so I added these fields to the user table. > It seems like the LoginEngine was not correctly installed or at least > the migration 001_initial_schema was incomplete. I can work around with > that, however, this error truly seems like a missing method. > > This is my first experience installing an engine. Any help is > appreciated! > > Dave > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- * J * ~
dave dumaresq
2006-Jun-09 02:10 UTC
[Rails] Re: LoginEngine: undefined method `generate_security_token''
James Adam wrote:> Do you have an existing User model in your application? If so, you > need to include the AuthenticatedUser model in it, as per the docs... > > - jamesThanks James, that''s got it! Btw, I''ve gone back and looked at the README docs and honestly don''t see anything about including AuthenticatedUser. Dave I''m not a complete idiot, some pieces are missing. -- Posted via http://www.ruby-forum.com/.