On Jan 4, 4:10 pm, radu puspana <[email protected]> wrote:
> and this line : user.detect {|current_user| current_user ==
> User.encrypt(password,current_user)}, shouldn't be something like
> user.detect {|current_user| current_user == User.encrypt
> (password,current_user.salt)}
that's right.
This means: iterate over the user collection, passing each element
into the block as current_user. return the first element for which the
condition in the block returns true.
> > You'll also find your code reads more easily if variables that contain
> > collections are pluralised (ie users = User.find :all rather than user
> > = User.find( :all))
>
> thx so much for this tip too, it doesn't have to do anything with the
> line user.detect {|current_user| current_user == User.encrypt
> (password, current_user)} right?
no. just a stylistic thing
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 [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.