Well, in that case, in your show/index action display all the projects (Project.all
) in your project table. This way all users have access to all the projects. Now, in your edit action, use user.projects.all
to display projects of that particular user. That should solve your problem, I don't see the need of any further association here.
Update:
This should suffice:
class Project < ActiveRecord::Base
belongs_to :user
class User < ActiveRecord::Base
has_many :projects_followed, :through => :projects
user has_many :projects_owned, :through => :projects
If you don't wish to create two more relations, create just one:
class ProjectsSubscribed
belongs_to :project
with three fields: project_id, is_owned, is_followed