Rails using multiple table names, although I told them to use singular

I tried to run rake test:profileand I got this error:

... Table 'mcif2.accounts' doesn't exist: DELETE FROM `accounts`

I know that accountsdoes not exist. He is called account.

I know that Rails uses plural table names by default, but here's mine config/environment.rb:

# 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 is what it looks like db/schema.rb:

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 accountssometimes. Any ideas?

If this helps give any clues at all, here are the results grep -ir 'accounts' *.

+3
source share
2 answers

, accounts.yml fixtures :accounts . , .

+1

set_table_name "account"
0

Source: https://habr.com/ru/post/1785469/


All Articles