Module: HotelBeds::Model

Included in:
Action::Request, HotelBasketAdd::Request::HotelService, CancellationPolicy, Comment, Contract, Customer, Destination, Hotel, Price, Purchase, Reference, Room, SearchResult, Supplier, PurchaseConfirm::Request::Purchase, PurchaseConfirm::Request::Service
Defined in:
lib/hotel_beds/model.rb,
lib/hotel_beds/model/room.rb,
lib/hotel_beds/model/hotel.rb,
lib/hotel_beds/model/price.rb,
lib/hotel_beds/model/comment.rb,
lib/hotel_beds/model/contract.rb,
lib/hotel_beds/model/customer.rb,
lib/hotel_beds/model/purchase.rb,
lib/hotel_beds/model/supplier.rb,
lib/hotel_beds/model/reference.rb,
lib/hotel_beds/model/destination.rb,
lib/hotel_beds/model/hotel_service.rb,
lib/hotel_beds/model/search_result.rb,
lib/hotel_beds/model/available_room.rb,
lib/hotel_beds/model/requested_room.rb,
lib/hotel_beds/model/cancellation_policy.rb

Defined Under Namespace

Classes: AvailableRoom, CancellationPolicy, Comment, Contract, Customer, Destination, Hotel, HotelService, Price, Purchase, Reference, RequestedRoom, Room, SearchResult, Supplier

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



6
7
8
9
10
11
# File 'lib/hotel_beds/model.rb', line 6

def self.included(base)
  base.class_eval do
    include Virtus.model
    include ActiveModel::Validations
  end
end

Instance Method Details

#deep_attributesObject



13
14
15
16
17
18
19
20
21
# File 'lib/hotel_beds/model.rb', line 13

def deep_attributes
  attributes.inject(Hash.new) do |result, (key, value)|
    if value.respond_to?(:deep_attributes)
      result.merge(key => value.deep_attributes)
    else
      result.merge(key => value)
    end
  end
end