groupify icon indicating copy to clipboard operation
groupify copied to clipboard

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

Open monroemann opened this issue 6 years ago • 2 comments

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

monroemann avatar Aug 19 '18 04:08 monroemann

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)

dwbutler avatar Aug 22 '18 07:08 dwbutler

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

monroemann avatar Aug 22 '18 14:08 monroemann