Class: C80Catoffers::Csample
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- C80Catoffers::Csample
- Defined in:
- app/models/c80_catoffers/csample.rb
Class Method Summary collapse
-
.all_widgeted ⇒ Object
выдать список тех Примеров, которые должны выводиться в виджете.
Instance Method Summary collapse
Class Method Details
.all_widgeted ⇒ Object
выдать список тех Примеров, которые должны выводиться в виджете
30 31 32 |
# File 'app/models/c80_catoffers/csample.rb', line 30 def self. self.joins(:csprops) end |
Instance Method Details
#csphoto_img ⇒ Object
34 35 36 37 |
# File 'app/models/c80_catoffers/csample.rb', line 34 def csphoto_img self.csphoto.present? ? MiniMagick::Image.open(self.csphoto.path):nil # [img["width"],img["height"]] end |
#recalc_summ_price ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/models/c80_catoffers/csample.rb', line 17 def recalc_summ_price sum = crows.all .map { |crow| crow.offer_price_integer.to_i } .inject(0) { |s, x| s + x } Rails.logger.debug "[TRACE] <C80Catoffers.recalc_summ_price> sum = #{sum}" self.update_column(:summ_price, sum) end |