Sha256: 7c5333f0661c1b9c8472937964f9d34802e36f752aecbcb38789981981750223
Contents?: true
Size: 654 Bytes
Versions: 5
Compression:
Stored size: 654 Bytes
Contents
class ShopVariant < ActiveRecord::Base belongs_to :created_by, :class_name => 'User' belongs_to :updated_by, :class_name => 'User' has_many :categories, :class_name => 'ShopCategory', :foreign_key => 'variant_id' 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
5 entries across 5 versions & 1 rubygems