-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding users to groups #56
Comments
The readme has plenty of examples. If you can post a code sample I can probably tell you what's wrong with it. |
class User < ApplicationRecord
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
groupify :group_member
groupify :named_group_member
validates :email, :presence => true, :uniqueness => true
has_many :members
has_many :groups, through: :member
end
class Group < ApplicationRecord
groupify :group, members: [:users, :assignments], default_members: :users
has_many :members
has_many :groups, through: :member
end
class Member < ApplicationRecord
belongs_to :group
belongs_to :user
end
class Membership < ApplicationRecord
groupify :group_membership
end These are all the models i have created. I can create new users and groups but i cant add users to groups, neither through groupify or the has_many & through association (you can see i tried both). Also i cannot populate the member or the Membership(groupify) tables. need help What are the commands that i should be using? |
If you're defining your own associations that override groupify's, that could be problematic. Some basic troubleshooting steps:
|
@dwbutler I am a newbie on rails 5 and cannot seem to add users to my groups. my group_membership table is empty.
Can someone help me with an example? even the syntax would help.
The text was updated successfully, but these errors were encountered: