Grayson Piercee wrote:
find :all, :conditions => "designation = 'Best Friend'"
and if i do current_user.best_friend everything works great, I can pull
up the user's name as an example. My user model has a one-to-many
relationship with interests. If I do current_user.best_friend.interests
however it gives a no method error.
The result of a "find :all" is an array, so your #best_friend method
returns an array which doesn't respond (normally!) to #interests. If
you change to "find :first" then this will work (except when there is no
best friend, in which case #best_friend would return nil and you'd get
an error trying to call #interests on nil).