Module: Epiphy::Repository::Helper
- Included in:
- ClassMethods
- Defined in:
- lib/epiphy/repository/helper.rb
Overview
Instance Method Summary collapse
-
#find_by(**option) ⇒ Object
Find the first record matching the.
Instance Method Details
#find_by(**option) ⇒ Object
Find the first record matching the
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/epiphy/repository/helper.rb', line 13 def find_by(**option) begin query do |r| r.filter(option).nth(0) end rescue RethinkDB::RqlRuntimeError => e #raise RethinkDB::RqlRuntimeError raise Epiphy::Model::EntityNotFound if e..include?("Index out of bounds") end end |