John Merlino wrote in post #968183: > Hey all, > > I'm following the Authenticating Your Users Recipe in Rails recipes, > which is a bit outdated I know. > > It says run a migration: > > def self.up > create_table :users do |t| > t.column "username", :string > t.column "password_salt", :string > t.column "password_hash", :string > end > end > > And then create a form: > > <% form_for @user, :url => { :action => "signup" } do |f| %> > > <%= f.label(:username, "username")%> > <%= f.text_field(:username) %><br/> > <%= f.label(:password, "password")%> > <%= f.password_field(:password) %><br/> > <%= f.submit("Sign Up")%> > > <% end %> > #Note that he's using the now defunct start_from_tag > > Problem is because I don't have a password field in users table in > database, I think it gives undefined method error for password when I > pass as argument in the password_field() method. However, in the book, > he does exactly that and it works for him. > > Is there anything I'm doing wrong?
The example should never have worked, unless he's relying on some particular authentication library (or an attr_accessor call) to create the password method. However, you're doing two things wrong here: * Following an outdated book * Trying to roll your own authentication library -- just go with Authlogic or Devise. > > Thanks for response. Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.