Sha256: be6ce623b9ee0263b77bcdede9d2bd381e534690f4d1423a27b136125d19d2d0
Contents?: true
Size: 791 Bytes
Versions: 11
Compression:
Stored size: 791 Bytes
Contents
module ActiveRecord module Associations class HasOneAssociation def construct_sql case when @reflection.options[:as] @finder_sql = "#{@reflection.quoted_table_name}.#{@reflection.options[:as]}_id = #{owner_quoted_id} AND " + "#{@reflection.quoted_table_name}.#{@reflection.options[:as]}_type = #{@owner.class.quote_value(@owner.class.base_class.name.to_s)}" else # CPK #@finder_sql = "#{@reflection.quoted_table_name}.#{@reflection.primary_key_name} = #{owner_quoted_id}" @finder_sql = full_columns_equals(@reflection.table_name, @reflection.cpk_primary_key, owner_quoted_id) end @finder_sql << " AND (#{conditions})" if conditions end end end end
Version data entries
11 entries across 11 versions & 1 rubygems