Sha256: 25d37ee6b1aee1fa05b03b74e79c62fb39288058514b27b723dc12179f7c7dcf

Contents?: true

Size: 579 Bytes

Versions: 3

Compression:

Stored size: 579 Bytes

Contents

module Refinery
  module RaceRegistrations
    class Group < Refinery::Core::BaseModel
      has_many :group_categories, :dependent => :destroy
      has_many :categories, :through => :group_categories
      has_many  :registration

      attr_accessible :title, :position, :category_ids

      acts_as_indexed :fields => [:title]

      validates :title, :presence => true, :uniqueness => true


      def category_ids
        Refinery::RaceRegistrations::GroupCategory.select('category_id').where("group_id = ?", self.id ).map{|gc| gc.category_id }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
refinerycms-registrations-0.1.2 app/models/refinery/race_registrations/group.rb
refinerycms-registrations-0.1.1 app/models/refinery/race_registrations/group.rb
refinerycms-registrations-0.1.0 app/models/refinery/race_registrations/group.rb