Skip to content

Instantly share code, notes, and snippets.

@exviva
exviva / create_tables.rb
Created January 25, 2017 02:10
Shameless create tables
RateStore.create_tables!
@exviva
exviva / write_rate.rb
Created January 25, 2017 02:11
Shameless writing
# 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
@exviva
exviva / query_rates.rb
Created January 25, 2017 02:12
Shameless querying
rates = Rate.where(hotel_id: 1,
room_type: '1 bed',
check_in_date: Date.today)