Module: ActiveRecord::ConnectionAdapters::PostgreSQL::DatabaseStatements
- Defined in:
- lib/composite_primary_keys/connection_adapters/postgresql/database_statements.rb
Instance Method Summary collapse
Instance Method Details
#sql_for_insert(sql, pk, binds) ⇒ Object
:nodoc:
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/composite_primary_keys/connection_adapters/postgresql/database_statements.rb', line 5 def sql_for_insert(sql, pk, binds) # :nodoc: if pk.nil? # Extract the table from the insert sql. Yuck. table_ref = extract_table_ref_from_insert_sql(sql) pk = primary_key(table_ref) if table_ref end # CPK # if pk = suppress_composite_primary_key(pk) # sql = "#{sql} RETURNING #{quote_column_name(pk)}" #end # NOTE pk can be false. if pk sql = "#{sql} RETURNING #{quote_column_names(pk)}" end super end |