On 12 January 2011 09:37, Sergio Lombrico <[email protected]> wrote:
> Can anyone shed some light on this ?

Exactly what the error says - you can't have a has_many through a has_one

Either chain the method calls to your user's profiles files:

  user = User.first
  files = user.profile.files

...or create a delegate method in user to return the profile's files:

  class User < AR
    has_one :profile
    def files
      self.profile ? self.profile.files : []
    end
  end


HTH

-- 
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.

Reply via email to