Method: ActiveNode::FinderMethods#find_by
- Defined in:
- lib/active_node/graph/finder_methods.rb
#find_by(*args) ⇒ Object
Finds the first record matching the specified conditions. There is no implied ordering so if order matters, you should specify it yourself.
If no record is found, returns nil.
Post.find_by name: 'Spartacus', rating: 4
Post.find_by "published_at < ?", 2.weeks.ago
78 79 80 |
# File 'lib/active_node/graph/finder_methods.rb', line 78 def find_by(*args) where(*args).take end |