Module: Epiphy::Repository::Helper
- Included in:
- ClassMethods
- Defined in:
- lib/epiphy/repository/helper.rb
Overview
Give repository useful helper class to query data. Only support ‘find_by` at this moment.
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
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/epiphy/repository/helper.rb', line 17 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 |