On Dec 13, 2010, at 3:46 PM, John Merlino wrote:
> 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?
What's your model look like? You'll want the following in your User model...
attr :password
And some hooks to convert that into password_hash I suppose as well...
-philip
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.