Sha256: 35ce23f297b37802d55f7e055fd76a6acf75d7223bd71e6f995a46fc5f222ae2

Contents?: true

Size: 489 Bytes

Versions: 7

Compression:

Stored size: 489 Bytes

Contents

class Detour::Group < ActiveRecord::Base
  validates :name,           presence: true, uniqueness: { scope: :flaggable_type }
  validates :flaggable_type, presence: true, inclusion: { in: Detour.config.flaggable_types }
  has_many :memberships, dependent: :destroy

  accepts_nested_attributes_for :memberships, allow_destroy: true

  attr_accessible :name, :flaggable_type, :memberships_attributes

  def to_s
    name
  end

  def flaggable_class
    flaggable_type.constantize
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
detour-0.0.12 app/models/detour/group.rb
detour-0.0.11 app/models/detour/group.rb
detour-0.0.10 app/models/detour/group.rb
detour-0.0.9 app/models/detour/group.rb
detour-0.0.7 app/models/detour/group.rb
detour-0.0.6 app/models/detour/group.rb
detour-0.0.5 app/models/detour/group.rb