Sha256: 0da3cdcde93bcf8bfeef54b37af23182f931cfd5df3da860fbd9c0561ac17c1e
Contents?: true
Size: 868 Bytes
Versions: 13
Compression:
Stored size: 868 Bytes
Contents
module Of class Offer < ActiveRecord::Base has_many :ophotos, :dependent => :destroy accepts_nested_attributes_for :ophotos, :reject_if => lambda { |attributes| !attributes.present? }, :allow_destroy => true has_and_belongs_to_many :items, class_name: 'C80Yax::Item', foreign_key: 'item_id', join_table: 'of_items_offers', association_foreign_key: 'offer_id' # validates_with DocValidator default_scope {order(:created_at => :desc)} def cover_url(thumb_size='thumb_md') res = '' unless ophotos.size.zero? res = ophotos.first.image.send(thumb_size).url end res end end end
Version data entries
13 entries across 13 versions & 1 rubygems