I have public and private projects in my app. I want to assign user to private projects for viewing and posting. What's the right way to do this? I tried with a permissionlist model and associated it to a project. but i got so confused that i couldn't make it.
Tracking visitor stats with Ruby on Rails
Rails Productivity Paradox [closed]
Saving Rails output into a variable
Create a table .
Uninitialized constant problem for Rails routes
How to uninstall Ruby on Rails plugin with migrations easily?
user_id, project_id and permission..
Rails order by in associated model
Rails form helpers: how to add an element to a collection?
. your models.
in the permissions link the project, user and the permission the user has on that project.
class Permission < ActiveRecord::Base belongs_to :user belongs_to :project end class User < ActiveRecord::Base has_many :permissions, :dependent => true has_many :projects, :through => :permissions end class Project < ActiveRecord::Base has_many :permissions, :dependent => true has_many :users, :through => :permissions end
. I hope this helps.. Regards.