Module: TokyoWrapper::TableMethods::Query
- Included in:
- TokyoWrapper::Table
- Defined in:
- lib/tokyo_wrapper/table_methods/query.rb
Instance Method Summary collapse
- #all_by_key_value(key, value, options = {}) ⇒ Object
- #all_by_multiple_key_values(key_value_hash = {}, options = {}) ⇒ Object
Instance Method Details
#all_by_key_value(key, value, options = {}) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/tokyo_wrapper/table_methods/query.rb', line 7 def all_by_key_value(key, value, = {}) result = @table.query do |query| query.add key, :equals, value end convert_values_to_array_for_keys_for_multiple_key_value_hashes(result, [:keys_for_has_many_association]) end |
#all_by_multiple_key_values(key_value_hash = {}, options = {}) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/tokyo_wrapper/table_methods/query.rb', line 14 def all_by_multiple_key_values(key_value_hash = {}, = {}) result = @table.query do |query| key_value_hash.each do |key, value| query.add key, :equals, value end end convert_values_to_array_for_keys_for_multiple_key_value_hashes(result, [:keys_for_has_many_association]) end |