Sha256: 72783e00a3f0ac99c6d8680215bfaa620b755d415063e76f61d344d0551fccc3

Contents?: true

Size: 476 Bytes

Versions: 4

Compression:

Stored size: 476 Bytes

Contents

class Facet < ActiveRecord::Base
  LABEL_ORDER = [["ascending", "value ASC, caption ASC"],
    ["descending", "value DESC, caption DESC"],
    ["manual", "position"]]

  belongs_to :catalog
  has_many :labels, :dependent => :destroy
  validates_presence_of :caption

  scope :exclude, lambda {|ids|
    { :conditions => ["id NOT IN(?)", ids]}
  }

  def ordered_labels
    #self.labels.find(:all, :order => self.label_order)
    self.labels.order(self.label_order)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fassets_core-0.4.0 app/models/facet.rb
fassets_core-0.3.1 app/models/facet.rb
fassets_core-0.3.0 app/models/facet.rb
fassets_core-0.2.0 app/models/facet.rb