Module: SexyScopes::ActiveRecord::DynamicMethods
- Defined in:
- lib/sexy_scopes/active_record/dynamic_methods.rb
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object (private)
Note:
Due to the way this works, be careful not to use this syntactic sugar with existing ActiveRecord::Base
methods (see last example).
Equivalent to calling #attribute with the missing method’s name
if the table has a column with that name.
Delegates to superclass implementation otherwise, eventually raising NoMethodError
.
43 44 45 46 47 48 49 50 |
# File 'lib/sexy_scopes/active_record/dynamic_methods.rb', line 43 def method_missing(name, *args, &block) if @sexy_scopes_attribute_methods_generated super else sexy_scopes_define_attribute_methods send(name, *args, &block) end end |