Class: ActiveRecord::Associations::AssociationScope::BindSubstitution

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record/associations/association_scope.rb

Instance Method Summary collapse

Constructor Details

#initialize(block) ⇒ BindSubstitution

Returns a new instance of BindSubstitution.



9
10
11
# File 'lib/active_record/associations/association_scope.rb', line 9

def initialize(block)
  @block = block
end

Instance Method Details

#bind_value(scope, column, value, alias_tracker) ⇒ Object



13
14
15
16
17
# File 'lib/active_record/associations/association_scope.rb', line 13

def bind_value(scope, column, value, alias_tracker)
  substitute = alias_tracker.connection.substitute_at(column)
  scope.bind_values += [[column, @block.call(value)]]
  substitute
end