Sha256: deadf925abded457f37130785cdfc4dddc896307f27deed8dea09d4fb40f327b

Contents?: true

Size: 561 Bytes

Versions: 8

Compression:

Stored size: 561 Bytes

Contents

class ShopVariant < ActiveRecord::Base
  
  belongs_to  :created_by,  :class_name => 'User'
  belongs_to  :updated_by,  :class_name => 'User'

  validates_presence_of   :name
  validates_uniqueness_of :name
  validates_presence_of   :options_json
  
  def options
    options = {}
    if self.options_json.present?
      options = ActiveSupport::JSON.decode(self.options_json)
      options = Forms::Config.deep_symbolize_keys(options)
    end
    options
  end
  
  def options=(options)
    self.options_json = ActiveSupport::JSON.encode(options)
  end
  
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
radiant-shop_variants-extension-0.1.3 app/models/shop_variant.rb
radiant-shop_variants-extension-0.1.2 app/models/shop_variant.rb
radiant-shop_variants-extension-0.1.1 app/models/shop_variant.rb
radiant-shop_variants-extension-0.1.0 app/models/shop_variant.rb
radiant-shop_variants-extension-0.0.4 app/models/shop_variant.rb
radiant-shop_variants-extension-0.0.3 app/models/shop_variant.rb
radiant-shop_variants-extension-0.0.1 app/models/shop_variant.rb
radiant-shop-extension-0.11.6 app/models/shop_variant.rb