Module: C80MapFloors::BuildingRepresentator::ClassMethods
- Defined in:
- app/models/c80_map_floors/building_representator.rb
Overview
noinspection ALL
Instance Method Summary collapse
Instance Method Details
#acts_as_map_building_representator ⇒ Object
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 53 54 55 56 57 58 |
# File 'app/models/c80_map_floors/building_representator.rb', line 26 def acts_as_map_building_representator class_eval do has_one :map_building, :as => :building_representator, :class_name => 'C80MapFloors::MapBuilding', :dependent => :nullify after_save :update_json scope :order_title, -> {order(:title => :asc)} def self.unlinked_buildings res = [] self.all.each do |building| unless building.map_building.present? res << building end end res end def update_json # MapJson.update_json # NOTE-json:: возможно, временно отключён end # выдать название привязанного к Зданию полигона def bpolygon_title res = '-' if self.map_building.present? res = "'#{self.map_building.title}'" end res end end end |