From what I gather, profiles should be the :through relation!
class Company < ActiveRecord::Base
has_many :profiles
has_many :managers, :through => :profiles
end
class Manager < ActiveRecord::Base
has_many :profiles
has_many :companies, :through => :profiles
end
class Profile < ActiveRecord::Base
belongs_to :company
belongs_to :manager
end
Now, you can assign many profiles for every Manager-Company.
Cheers!
- Gautam
On Fri, May 18, 2012 at 3:22 PM, Mauro
<mrsanna1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> I have:
> Manager
> has_many :companies
> has_many :profiles
>
> Company
> has_many :managers
>
> Profile
> has_many :managers
>
> I want to assign on or more profiles to every Manager-Company
>
> I''m trying:
>
> Manager
> has_many :managements
> has_many :companies, :through => :managements
> has_many :profiles, :through => :managements
>
> Company
> has_many :managements
> has_many :managers, :through => :managements
>
> Profile
> has_many :managers
>
> But the result it seems not as expected.
>
> --
> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To unsubscribe from this group, send email to
>
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
--
~~~~~~~~~~~~~~~
All wiyht. Rho sritched mg kegtops awound?
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.