I'm getting an "NoMethodError" traversing a named collection. Let me
I have a named collection called best_friend in a class called user
find :all, :conditions => "designation = 'Best Friend'"
and if i do current_user.best_friend everything works great, I can
up the user's name as an example. My user model has a one-to-many
relationship with interests. If I do
however it gives a no method error.
Of course: your best_friend method returns an array (bit odd that a
method return a collection is a singular). That array doesn't have an
interests method, though its members do.
ALso from the code you've posted you've made best_friend a class
method rather than an instance method.
Finally, why not use an association for this?