Module: C80Map::BuildingRepresentator::ClassMethods
- Defined in:
- app/models/c80_map/building_representator.rb
Instance Method Summary collapse
Instance Method Details
#acts_as_map_building_representator ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/models/c80_map/building_representator.rb', line 19 def acts_as_map_building_representator class_eval do has_many :map_buildings, :as => :building_representator, :class_name => 'C80Map::Building', :dependent => :destroy after_save :update_json def self.unlinked_buildings res = [] self.all.each do |building| # if building.map_buildings.count == 0 res << building # end end res end def update_json MapJson.update_json end end end |