1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
|
# File 'lib/active_record/connection_adapters/ibm_db_pstmt.rb', line 1180
def construct_sql
@finder_sql_param_array = []
case
when @reflection.options[:as]
@finder_sql =
"#{@reflection.quoted_table_name}.#{@reflection.options[:as]}_id = ? AND " +
"#{@reflection.quoted_table_name}.#{@reflection.options[:as]}_type = ?"
@finder_sql_param_array << owner_quoted_id
@finder_sql_param_array << @owner.class.quote_value(@owner.class.base_class.name.to_s)
else
@finder_sql = "#{@reflection.quoted_table_name}.#{@reflection.primary_key_name} = ?"
@finder_sql_param_array << owner_quoted_id
end
if conditions
condition, *parameters = conditions
@finder_sql << " AND (#{condition})"
@finder_sql_param_array = @finder_sql_param_array + parameters unless parameters.nil?
end
end
|