aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2016-01-05 08:05:46 +0900
committerRyuta Kamizono <kamipo@gmail.com>2016-01-05 10:02:29 +0900
commit326b12ae528433238b41941843849447fdbe7435 (patch)
treed69e417636e31cdf1082119997845ab5b081f0c2 /activerecord/lib
parent9fb4efedfc6409eaf59a8a55771eecacbb9f5c71 (diff)
downloadrails-326b12ae528433238b41941843849447fdbe7435.tar.gz
rails-326b12ae528433238b41941843849447fdbe7435.tar.bz2
rails-326b12ae528433238b41941843849447fdbe7435.zip
Fix `connection#create` in PG adapter
Originally `connection#create` had aliased to `connection#insert` in PG adapter. But it was broken by #7447. Re-alias `create` to `insert` for fixing it.
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb1
-rw-r--r--activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb1
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb4
-rw-r--r--activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb1
4 files changed, 1 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
index d3bc378bea..008f356601 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
@@ -119,6 +119,7 @@ module ActiveRecord
value = exec_insert(sql, name, binds, pk, sequence_name)
id_value || last_inserted_id(value)
end
+ alias create insert
# Executes the update statement and returns the number of rows affected.
def update(arel, name = nil, binds = [])
diff --git a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb
index 96a3a44b30..8baf63232a 100644
--- a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb
@@ -140,7 +140,6 @@ module ActiveRecord
super
id_value || @connection.last_id
end
- alias :create :insert_sql
def exec_insert(sql, name, binds, pk = nil, sequence_name = nil)
execute to_sql(sql, binds), name
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb b/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb
index 0e0c0e993a..a59427b1f0 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb
@@ -90,10 +90,6 @@ module ActiveRecord
end
end
- def create
- super.insert
- end
-
# The internal PostgreSQL identifier of the money data type.
MONEY_COLUMN_TYPE_OID = 790 #:nodoc:
# The internal PostgreSQL identifier of the BYTEA data type.
diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
index 163cbb875f..99053703fd 100644
--- a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
@@ -294,7 +294,6 @@ module ActiveRecord
super
id_value || @connection.last_insert_row_id
end
- alias :create :insert_sql
def select_rows(sql, name = nil, binds = [])
exec_query(sql, name, binds).rows