Module: NoBrainer::Criteria::Find
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/no_brainer/criteria/find.rb
Instance Method Summary collapse
- #find(pk) ⇒ Object (also: #find!)
- #find?(pk) ⇒ Boolean
- #find_by(*args, &block) ⇒ Object (also: #find_by!, #find_by?)
Instance Method Details
#find(pk) ⇒ Object Also known as: find!
14 15 16 |
# File 'lib/no_brainer/criteria/find.rb', line 14 def find(pk) find?(pk) || raise_not_found(pk) end |
#find?(pk) ⇒ Boolean
10 11 12 |
# File 'lib/no_brainer/criteria/find.rb', line 10 def find?(pk) without_ordering.where(model.pk_name => pk).first end |
#find_by(*args, &block) ⇒ Object Also known as: find_by!, find_by?
4 5 6 |
# File 'lib/no_brainer/criteria/find.rb', line 4 def find_by(*args, &block) raise "find_by() has unclear semantics. Please use where().first instead" end |