Class: ActiveRecord::Futures::QueryRecording::KlassProxy
- Defined in:
- lib/active_record/futures/query_recording.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
Attributes inherited from Proxy
Instance Method Summary collapse
- #build_default_scope ⇒ Object
- #find_by_sql(sql, binds = []) ⇒ Object
-
#initialize(klass, connection) ⇒ KlassProxy
constructor
A new instance of KlassProxy.
Methods inherited from Proxy
#!=, #==, #method_missing, #proxy?, #respond_to?
Constructor Details
#initialize(klass, connection) ⇒ KlassProxy
Returns a new instance of KlassProxy.
20 21 22 23 24 |
# File 'lib/active_record/futures/query_recording.rb', line 20 def initialize(klass, connection) super(klass) @klass = klass @connection = connection end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ActiveRecord::Futures::Proxy
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
18 19 20 |
# File 'lib/active_record/futures/query_recording.rb', line 18 def connection @connection end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
18 19 20 |
# File 'lib/active_record/futures/query_recording.rb', line 18 def klass @klass end |
Instance Method Details
#build_default_scope ⇒ Object
26 27 28 29 30 |
# File 'lib/active_record/futures/query_recording.rb', line 26 def build_default_scope scope = @klass.send(:build_default_scope) scope.instance_variable_set(:@klass, self) scope end |
#find_by_sql(sql, binds = []) ⇒ Object
32 33 34 35 36 |
# File 'lib/active_record/futures/query_recording.rb', line 32 def find_by_sql(sql, binds = []) connection.recorded_query = sanitize_sql(sql) connection.recorded_binds = binds [] end |