module NoBrainer::Criteria::Find
Public Instance Methods
find(pk)
click to toggle source
# File lib/no_brainer/criteria/find.rb, line 14 def find(pk) find?(pk) || raise_not_found(pk) end
Also aliased as: find!
find?(pk)
click to toggle source
# 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)
click to toggle source
# 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
Private Instance Methods
raise_not_found(pk)
click to toggle source
# File lib/no_brainer/criteria/find.rb, line 21 def raise_not_found(pk) raise NoBrainer::Error::DocumentNotFound, "#{model} :#{model.pk_name}=>#{pk.inspect} not found" end