I have some problems setting up my desired relationship in my application. Some help and hints would be appreciated!
I have the following models:
- User (id, username)
- Company (id, name)
- Campaign (id, name, company_id)
- Relationship (user_id, company_id)
The relationship is supposed to connect the user to many companies. Company has_many campaigns.
I want to to connect all the campaigns related to the companies that the specific user follows.
Users > (Relationships) > Companies > Campaigns
I'd better not post some code since it's just a mess and not at all doing what I want.
I've also really tried to follow railstutorial.org, http://ruby.railstutorial.org/chapters/following-users#top and change it the way I want with no success.
I need your help. :)