Rails using plural table names even though I told it to use singular
Posted
by
Jason Swett
on Stack Overflow
See other posts from Stack Overflow
or by Jason Swett
Published on 2011-01-14T16:17:40Z
Indexed on
2011/01/14
17:53 UTC
Read the original article
Hit count: 133
ruby-on-rails
|database
I tried to run rake test:profile
and I got this error:
... Table 'mcif2.accounts' doesn't exist: DELETE FROM `accounts`
I know accounts
doesn't exist. It's called account
.
I know Rails uses plural table names by default but here's what my config/environment.rb
looks like:
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
McifRails::Application.initialize!
ActiveRecord::Base.pluralize_table_names = false
And here's what db/schema.rb
looks like:
ActiveRecord::Schema.define(:version => 0) do
create_table "account", :force => true do |t|
t.integer "customer_id", :limit => 8, :null => false
t.string "account_number", :null => false
t.integer "account_type_id", :limit => 8
t.date "open_date", :null => false
So I don't understand why Rails still wants to call it accounts
sometimes. Any ideas?
If it helps give any clues at all, here are the results of grep -ir 'accounts' *
.
© Stack Overflow or respective owner