Module: Superstore::FinderMethods
- Included in:
- Scope
- Defined in:
- lib/superstore/scope/finder_methods.rb
Instance Method Summary collapse
Instance Method Details
#all ⇒ Object
17 18 19 |
# File 'lib/superstore/scope/finder_methods.rb', line 17 def all clone end |
#find(ids) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/superstore/scope/finder_methods.rb', line 3 def find(ids) if ids.is_a?(Array) find_some(ids) else find_one(ids) end end |
#find_by_id(ids) ⇒ Object
11 12 13 14 15 |
# File 'lib/superstore/scope/finder_methods.rb', line 11 def find_by_id(ids) find(ids) rescue Superstore::RecordNotFound nil end |
#first ⇒ Object
21 22 23 |
# File 'lib/superstore/scope/finder_methods.rb', line 21 def first limit(1).to_a.first end |
#to_ids ⇒ Object
25 26 27 |
# File 'lib/superstore/scope/finder_methods.rb', line 25 def to_ids klass.adapter.to_ids self end |