Skip to content
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

Two More Quick Questions! (RE: Creating Groups, & Classes) #72

Open
monroemann opened this issue Aug 19, 2018 · 2 comments
Open

Two More Quick Questions! (RE: Creating Groups, & Classes) #72

monroemann opened this issue Aug 19, 2018 · 2 comments
Labels

Comments

@monroemann
Copy link

monroemann commented Aug 19, 2018

Hi Again David, @dwbutler

Thanks again for your time.

  1. To make custom groups, do we simply type: group = Group.new? In other words, to create the math group, we'd just type math = Group.new? Does that also create a class of the same name?

  2. Could you kindly explain the following in a bit more depth?

class Organization < Group
  has_members :offices, :equipment
end
  • What is the class 'Organization'? Is that a group name? How was that created? By the command organization = Group.new? In which file is this? organization.rb (the model)?
  • For an example with French, would it be: has_members :native_speakers, :learners, :tutors, :teachers? Do you have a use case of how we'd use the various member designations? I.e. what to do with :native_speakers, :learners, etc.?

Any clarification on how to create custom group names would (i.e. these issues) would be soooooo wonderfully helpful.

Thanks!
-Monroe Mann
Break Diving, Inc.
www.BreakDiving.org

@dwbutler
Copy link
Owner

dwbutler commented Aug 22, 2018

Hi,

Any model can be made into a Groupify group by calling groupify :group. Making a Group model is common, but not necessary. The Organization model is just an example of using Single Table Inheritance.

For your language group example, you could create a LanguageGroup model, if you wish, and specify that it can have users as members. Then add these users with a particular role to indicate what they do within the group. Some example code might look like:

french_group = LanguageGroup.create!(name: "French")
french_group.add(monroe, as: :teacher)

@monroemann
Copy link
Author

monroemann commented Aug 22, 2018

Thank you David. I am reviewing all of this with my team now. We really appreciate your response. Means a great deal to us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants