app/models/c80_catoffers/offer.rb in c80_catoffers-0.1.0.3 vs app/models/c80_catoffers/offer.rb in c80_catoffers-0.1.0.4
- old
+ new
@@ -13,10 +13,12 @@
scope :def_order, -> {order(:created_at => :desc)}
has_and_belongs_to_many :categories
has_and_belongs_to_many :props
+ has_many :crows, :dependent => :destroy
+
extend FriendlyId
friendly_id :title, use: :slugged
def normalize_friendly_id(input)
input.to_s.to_slug.normalize(transliterations: :russian).to_s
end
@@ -64,9 +66,14 @@
res = ''
if ophotos.count > 0
res = ophotos.first.image_thumb(thumb_size)
end
res
+ end
+
+ def price_integer
+ d = self.price.match '\d+'
+ d.present? ? d[0].to_i : 0
end
end
end
\ No newline at end of file