Sha256: c5c3ff6235beebbf1d3bbe67281a22fdae3bb0d342fde006fe62946069477f3d
Contents?: true
Size: 794 Bytes
Versions: 25
Compression:
Stored size: 794 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
25 entries across 25 versions & 1 rubygems