Module: C80MapFloors::FloorRepresentator::ClassMethods
- Defined in:
- app/models/c80_map_floors/floor_representator.rb
Instance Method Summary collapse
Instance Method Details
#acts_as_map_floor_representator ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'app/models/c80_map_floors/floor_representator.rb', line 19 def acts_as_map_floor_representator class_eval do has_one :floor, :as => :map_floor_representator, :class_name => 'C80MapFloors::Floor', :dependent => :nullify # after_save :update_json # NOTE:: возможно, временно # выдать список несвязанных с полигонами Этажей (указанного здания building_id) # def self.unlinked_floors(building_id) # building_id - не используется, надо дописать код, чтобы использовался # res = [] # self.all.each do |sfloor| # unless sfloor.floor.present? # res << sfloor # end # end # Rails.logger.debug "[TRACE] <floor_representator.unlinked_floors> Кол-во несвязанных Этажей: #{res.count}." # res # end def update_json MapJson.update_json end # выдать название привязанного к Этажу полигона (но у Этажа вместо полигона выступает картинка) def fpolygon_title res = '-' if self.floor.present? res = "'#{self.floor.title}'" end res end end end |