Sha256: 1039b852fe617edabf490f7e01f0c609c1bea938061e1bb9d80b34cc33193562
Contents?: true
Size: 795 Bytes
Versions: 19
Compression:
Stored size: 795 Bytes
Contents
class Group < ActiveRecord::Base # Rolify Gem resourcify # MessageTrain Gem message_train only: :recipient, valid_senders: :owners, name_column: :title, slug_column: :slug, collectives_for_recipient: :membered_by, valid_recipients: :recipients # Callbacks before_create :set_slug scope :membered_by, ->(user) { with_roles([:member, :owner], user).uniq } def set_slug # Manually generate slug instead of using friendly id, for testing. self.slug = title.downcase.gsub(/[^a-z0-9]+/, '-') end def owners User.with_role(:owner, self) end def recipients User.with_role(:member, self) end def self.fallback_address_book(user) Group.with_role(:owner, user) end end
Version data entries
19 entries across 19 versions & 1 rubygems