Class: Ohm::Model
- Inherits:
-
Object
- Object
- Ohm::Model
- Defined in:
- lib/ohm/find_by.rb
Constant Summary collapse
- FIND_BY_METHOD =
/^find_by_/
Class Method Summary collapse
Class Method Details
.method_missing(method, *args, &block) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/ohm/find_by.rb', line 5 def self.method_missing(method, *args, &block) if method.to_s =~ FIND_BY_METHOD index = method.to_s[8..-1].to_sym raise(IndexNotFound, index) unless self.indices.include?(index) self.find(index => args) else super end end |
.respond_to?(method) ⇒ Boolean
15 16 17 18 |
# File 'lib/ohm/find_by.rb', line 15 def self.respond_to?(method) return true if method =~ FIND_BY_METHOD super end |