Class: ActiveRecord::Associations::HasOneAssociation
- Inherits:
-
BelongsToAssociation
- Object
- BelongsToAssociation
- ActiveRecord::Associations::HasOneAssociation
- Defined in:
- lib/composite_primary_keys/associations.rb
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#construct_sql ⇒ Object
382 383 384 385 386 387 388 389 390 391 392 393 |
# File 'lib/composite_primary_keys/associations.rb', line 382 def construct_sql case when @reflection.[:as] @finder_sql = "#{@reflection.klass.quoted_table_name}.#{@reflection.[:as]}_id = #{@owner.quoted_id} AND " + "#{@reflection.klass.quoted_table_name}.#{@reflection.[:as]}_type = #{@owner.class.quote_value(@owner.class.base_class.name.to_s)}" else @finder_sql = full_columns_equals(@reflection.klass.table_name, @reflection.primary_key_name, @owner.quoted_id) end @finder_sql << " AND (#{conditions})" if conditions end |