Sha256: ca7bcea541ed69eedd47873696b00126ba8f2cd8cd60f679b175b9450691f03b

Contents?: true

Size: 383 Bytes

Versions: 4

Compression:

Stored size: 383 Bytes

Contents

module PiggybakVariants
  class OptionValue < ActiveRecord::Base
    has_and_belongs_to_many :variants
    belongs_to :option, :inverse_of => :option_values

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
piggybak_variants-0.1.3 app/models/piggybak_variants/option_value.rb
piggybak_variants-0.1.2 app/models/piggybak_variants/option_value.rb
piggybak_variants-0.1.1 app/models/piggybak_variants/option_value.rb
piggybak_variants-0.1.0 app/models/piggybak_variants/option_value.rb