Module: Searchable

Included in:
Bezel::BezelrecordBase
Defined in:
lib/bezelrecord_base/searchable.rb

Instance Method Summary collapse

Instance Method Details

#where(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/bezelrecord_base/searchable.rb', line 4

def where(params)
  where_line = params.keys.map{|key| "#{key} = ?"}
  results = DBConnection.execute("SELECT\n*\nFROM\n\#{table_name}\nWHERE\n\#{where_line.join(\" AND \")}\n", *params.values)
  parse_all(results)
end