groupify
groupify copied to clipboard
Two More Quick Questions! (RE: Creating Groups, & Classes)
Hi Again David, @dwbutler
Thanks again for your time.
-
To make custom groups, do we simply type:
group = Group.new
? In other words, to create the math group, we'd just typemath = Group.new
? Does that also create a class of the same name? -
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
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)
Thank you David. I am reviewing all of this with my team now. We really appreciate your response. Means a great deal to us.