Sha256: ae05edaac96ee5287d5a255ce28040b14385ae250a92e20d65be4ca37b0d7baa

Contents?: true

Size: 445 Bytes

Versions: 1

Compression:

Stored size: 445 Bytes

Contents

module PiggybakSimpleVariants
  class OptionValue < ActiveRecord::Base
  	has_many :variant_options
  	has_many :variants, through: :variant_options 
    belongs_to :option, :inverse_of => :option_values

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

    scope :hash_ordered, -> { includes(:option).order("piggybak_simple_variants_options.position ASC, piggybak_simple_variants_option_values.position ASC") }

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
piggybak_simple_variants-0.1.2 app/models/piggybak_simple_variants/option_value.rb