Sha256: a5712b525ee82d8de95ae1144a9ea10ddb5f558bed4de61e9d2ab7202948e417

Contents?: true

Size: 1017 Bytes

Versions: 6

Compression:

Stored size: 1017 Bytes

Contents

module C80Yax
  class PropName < ActiveRecord::Base

    validates :title,
              presence: true,
              uniqueness: true,
              length: { in: 2..150 }

    # has_many :item_props, :dependent => :destroy
    has_and_belongs_to_many :strsubcats
    belongs_to :uom
    accepts_nested_attributes_for :uom

    has_many :im_old_price_and_this_is_link_to_my_normal_price, # NOTE:: поправить, как дойдёт дело
             class_name: 'C80Yax::ItemProp',
             foreign_key: 'related_id'

    # для цены можно указать старую цену (если она есть)
    belongs_to :related,
               class_name: 'C80Yax::ItemProp'

    has_and_belongs_to_many :main_props
    has_and_belongs_to_many :common_props
    has_and_belongs_to_many :price_props

    default_scope {order(:title => :asc)}

    # validates_with PropNameValidator
    # TODO:: добавить валидацию title на уникальность и длину

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
c80_yax-0.1.0.7 app/models/c80_yax/prop_name.rb
c80_yax-0.1.0.6 app/models/c80_yax/prop_name.rb
c80_yax-0.1.0.5 app/models/c80_yax/prop_name.rb
c80_yax-0.1.0.4 app/models/c80_yax/prop_name.rb
c80_yax-0.1.0.3 app/models/c80_yax/prop_name.rb
c80_yax-0.1.0.2 app/models/c80_yax/prop_name.rb