Module: Grist::Searchable
- Included in:
- Type::Base
- Defined in:
- lib/grist/searchable.rb
Class Method Summary collapse
-
.find_by(*params) ⇒ Array
Finds a record based on the given parameters.
Class Method Details
.find_by(*params) ⇒ Array
Finds a record based on the given parameters.
8 9 10 11 12 13 14 15 |
# File 'lib/grist/searchable.rb', line 8 def self.find_by(*params) objs = all objs.select do |obj| params.all? do |key, value| obj.instance_variable_get("@#{key}") == value end end end |