Module: ActiveRecord::Delegation::ClassSpecificRelation::ClassMethods
- Defined in:
- activerecord/lib/active_record/relation/delegation.rb
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#delegate(method, opts = {}) ⇒ Object
47 48 49 50 51 52 |
# File 'activerecord/lib/active_record/relation/delegation.rb', line 47 def delegate(method, opts = {}) @delegation_mutex.synchronize do return if method_defined?(method) super end end |
#delegate_to_scoped_klass(method) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'activerecord/lib/active_record/relation/delegation.rb', line 29 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 <<-RUBY, __FILE__, __LINE__ + 1 def #{method}(*args, &block) scoping { @klass.#{method}(*args, &block) } end RUBY else define_method method do |*args, &block| scoping { @klass.send(method, *args, &block) } end end end end |
#name ⇒ Object
25 26 27 |
# File 'activerecord/lib/active_record/relation/delegation.rb', line 25 def name superclass.name end |