Sha256: 5009b6b10a9d8250711a20df4a7a3c232dd1a25770c25b27f7db0aff2a71b0bb

Contents?: true

Size: 467 Bytes

Versions: 11

Compression:

Stored size: 467 Bytes

Contents

module PiggybakVariants
  class OptionValue < ActiveRecord::Base
    self.table_name = "option_values"

    attr_accessible :name, :position
    has_and_belongs_to_many :variants
    belongs_to :option, :inverse_of => :option_values

    scope :ordered, :order => "position ASC"
    scope :hash_ordered, :include => :option, :order => "options.position ASC, option_values.position ASC"

    def admin_label
      "#{self.option.name}: #{self.name}"
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
piggybak_variants-0.0.17 app/models/piggybak_variants/option_value.rb
piggybak_variants-0.0.15 app/models/piggybak_variants/option_value.rb
piggybak_variants-0.0.14 app/models/piggybak_variants/option_value.rb
piggybak_variants-0.0.13 app/models/piggybak_variants/option_value.rb
piggybak_variants-0.0.12 app/models/piggybak_variants/option_value.rb
piggybak_variants-0.0.11 app/models/piggybak_variants/option_value.rb
piggybak_variants-0.0.10 app/models/piggybak_variants/option_value.rb
piggybak_variants-0.0.9 app/models/piggybak_variants/option_value.rb
piggybak_variants-0.0.8 app/models/piggybak_variants/option_value.rb
piggybak_variants-0.0.7 app/models/piggybak_variants/option_value.rb
piggybak_variants-0.0.6 app/models/piggybak_variants/option_value.rb