method
delegate_to_scoped_klass
v4.2.7 -
Show latest stable
- Class:
ActiveRecord::Delegation::ClassSpecificRelation::ClassMethods
delegate_to_scoped_klass(method)public
No documentation available.
# File activerecord/lib/active_record/relation/delegation.rb, line 63
def delegate_to_scoped_klass(method)
@delegation_mutex.synchronize do
return if method_defined?(method)
if method.to_s =~ /\A[a-zA-Z_]\w*[!?]?\z/
module_eval def #{method}(*args, &block) scoping { @klass.#{method}(*args, &block) } end, __FILE__, __LINE__ + 1
else
define_method method do |*args, &block|
scoping { @klass.public_send(method, *args, &block) }
end
end
end
end