Hi everyone.

I am facing a problem with has_many :through with the following model
relations:

class User < AR
  has_one :profile
  has_many :files, :through => :profile
end

class Profile < AR
  belongs_to :user
  has_many :files
end

class File < AR
  belongs_to :profile
end

While the call user.files succeeds with no problem, the following
assignment fails.

f = File.new
u = User.first
u.files << f # FAILURE HERE!

Rails spits out a
ActiveRecord::HasManyThroughCantAssociateThroughHasOneOrManyReflection
exception.

Can anyone shed some light on this ?

Cheers,

sergioL

-- 
Posted via http://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 [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