Created
January 25, 2017 02:11
-
-
Save exviva/ca228f4c853d8087d6622d1c34d0df6c to your computer and use it in GitHub Desktop.
Shameless writing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# All index fields are required, | |
# the rest is the schemaless content | |
rate = Rate.put(hotel_id: 1, | |
room_type: '1 bed', | |
check_in_date: Date.today, | |
discount_type: 'geo', | |
net_price: 120.0) # potentially ~20 fields | |
rate[:hotel_id] # => 1 | |
rate[:net_price] # => 120.0 | |
rate.ref_key # => 0 # that's the version | |
rate[:net_price] = 130.0 | |
rate.save | |
rate.ref_key # => 1 | |
# Or: | |
rate.update(net_price: 140.0) | |
rate.ref_key # => 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment