File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed
lib/active_record/connection_adapters/abstract Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ def columns(table_name, name = nil) end
107107 # See also TableDefinition#column for details on how to create columns.
108108 def create_table ( table_name , options = { } )
109109 table_definition = TableDefinition . new ( self )
110- table_definition . primary_key ( options [ :primary_key ] || Base . get_primary_key ( table_name ) ) unless options [ :id ] == false
110+ table_definition . primary_key ( options [ :primary_key ] || Base . get_primary_key ( table_name . to_s . singularize ) ) unless options [ :id ] == false
111111
112112 yield table_definition if block_given?
113113
Original file line number Diff line number Diff line change @@ -224,7 +224,7 @@ def test_create_table_with_primary_key_prefix_as_table_name_with_underscore
224224 t . column :foo , :string
225225 end
226226
227- assert_equal %w( foo testings_id ) , Person . connection . columns ( :testings ) . map { |c | c . name } . sort
227+ assert_equal %w( foo testing_id ) , Person . connection . columns ( :testings ) . map { |c | c . name } . sort
228228 ensure
229229 Person . connection . drop_table :testings rescue nil
230230 ActiveRecord ::Base . primary_key_prefix_type = nil
@@ -237,7 +237,7 @@ def test_create_table_with_primary_key_prefix_as_table_name
237237 t . column :foo , :string
238238 end
239239
240- assert_equal %w( foo testingsid ) , Person . connection . columns ( :testings ) . map { |c | c . name } . sort
240+ assert_equal %w( foo testingid ) , Person . connection . columns ( :testings ) . map { |c | c . name } . sort
241241 ensure
242242 Person . connection . drop_table :testings rescue nil
243243 ActiveRecord ::Base . primary_key_prefix_type = nil
You can’t perform that action at this time.
0 commit comments