Module: ActiveHash::ARApi::FindBy
- Included in:
- ActiveMocker::ActiveHash::ARApi::ClassMethods
- Defined in:
- lib/active_hash/find_by.rb
Instance Method Summary collapse
Instance Method Details
#find_by(options = {}) ⇒ Object
8 9 10 |
# File 'lib/active_hash/find_by.rb', line 8 def find_by( = {}) send(:where, ).first end |
#find_by!(options = {}) ⇒ Object
12 13 14 15 16 |
# File 'lib/active_hash/find_by.rb', line 12 def find_by!(={}) result = find_by() raise ActiveRecord::RecordNotFound if result.blank? result end |