Class: QueuedListing
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- QueuedListing
- Defined in:
- app/models/queued_listing.rb
Instance Method Summary collapse
Instance Method Details
#create_listing_and_remove_myself ⇒ Object
27 28 29 |
# File 'app/models/queued_listing.rb', line 27 def create_listing_and_remove_myself create_or_update_listing ? self.destroy : false end |
#create_or_update_listing ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/models/queued_listing.rb', line 10 def create_or_update_listing listing = self.import.listings. eager_load(:address). eager_load(:appliances). eager_load(:participants). eager_load(:photos). find_or_initialize_by( listing_key: Mapper::unique_identifier(self) ) if (listing. != mapper.(self, listing)) Mapper::RESO_LISTING_ATTRIBUTES.each do |attribute| listing.send("#{attribute}=", mapper.send(attribute, self, listing)) end listing.save end end |
#mapper ⇒ Object
6 7 8 |
# File 'app/models/queued_listing.rb', line 6 def mapper "Mapper::#{self.import.import_format.name.downcase.capitalize}".constantize end |