Module: Searchable
- Included in:
- MonoRM::Base
- Defined in:
- lib/monorm/searchable.rb
Instance Method Summary collapse
Instance Method Details
#where(params) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/monorm/searchable.rb', line 2 def where(params) where_line = params.keys.map do |key| "#{key} = INTERPOLATOR_MARK" end where_line = where_line.join(' AND ') param_values = params.values data = MonoRM::DBConnection.execute(<<-SQL, *param_values) SELECT * FROM #{self.table_name} WHERE #{where_line} SQL parse_all(data) end |