Class: ActiveRecord::Associations::HasAndBelongsToManyAssociation
- Inherits:
-
AssociationCollection
- Object
- AssociationCollection
- ActiveRecord::Associations::HasAndBelongsToManyAssociation
- Defined in:
- lib/composite_primary_keys/associations.rb
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#construct_sql ⇒ Object
314 315 316 317 318 319 320 321 322 323 324 325 326 |
# File 'lib/composite_primary_keys/associations.rb', line 314 def construct_sql @reflection.[:finder_sql] &&= interpolate_sql(@reflection.[:finder_sql]) if @reflection.[:finder_sql] @finder_sql = @reflection.[:finder_sql] else @finder_sql = full_columns_equals(@reflection.[:join_table], @reflection.primary_key_name, @owner.quoted_id) @finder_sql << " AND (#{conditions})" if conditions end @join_sql = "INNER JOIN #{@reflection.active_record.connection.quote_table_name(@reflection.[:join_table])} ON " + full_composite_join_clause(@reflection.klass.table_name, @reflection.klass.primary_key, @reflection.[:join_table], @reflection.association_foreign_key) end |