Soh,

Not sure why you are not able to access the attributes in the use case
but can I ask why you are not using the dynamic find_by methods ie
User.find_by_username('kena')  ?

--
Robert Zotter
Zapient, LLC
Ruby on Rails Development and Consulting

On Oct 27, 6:49 pm, Soh Dubom <[EMAIL PROTECTED]>
wrote:
> Reading n writing object attributes
>
> Hi. In this simple example I have a User class with the class method:
>
>   def self.find_user(name)
>     user = self.find(:first, :conditions => ["username = ?", name])
>     # user.salt
>   end
>
> In the rails console I do the following:
>
> >> u = User.find_user('kena')
>
> => #<User id: 5, username: "test", hashed_password:
> "c1a18d933c06f5a3ebd8d1d155d294f39447fbf2", salt:
> "177647700.129851651671097", email: "", created_at: "2008-10-28
> 00:54:42", updated_at: "2008-10-28 00:54:42">>> u.salt
> => nil
> >> u.username
>
> => nil
>
> What I don't understand is why I can't access its attributes?
> --
> Posted viahttp://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@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to