неопределенный метод `railties_load_path 'для nil: NilClass - PullRequest
0 голосов
/ 19 апреля 2019

Я создаю производственную базу данных, но когда я запускаю rake db: create, я получаю эту ошибку:

rake db:create --trace

** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
NoMethodError: undefined method `railties_load_path' for I18n:Module

код, показывающий ошибку: gems / railties-5.2.3 / lib / rails/engine.rb:589:in `block in '

   initializer :add_locales do
      config.i18n.railties_load_path << paths["config/locales"]
    end

Теперь, когда я изначально настроил I18n, не было никаких созданных инициализаторов / локалей или что-то, что мне подсказывало, но я чувствую, что это такговорит мне, что мне нужно.Я не знаю, как лучше всего решить эту проблему.

В моих поисках было что-то об этом конфликтующее с will_paginate, которое я имею здесь, но не было никаких решений о том, как это исправить или как это действительно конфликтует,

мой config / application.rb выглядит так:

module MyProjectName
  class Application < Rails::Application
    # Initialize configuration defaults for originally generated Rails version.
    config.load_defaults 5.2

    I18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')]

    I18n.available_locales = [:en, :he]

    config.time_zone = 'Jerusalem'

    # Settings in config/environments/* take precedence over those specified here.
    # Application configuration can go into files in config/initializers
    # -- all .rb files in that directory are automatically loaded after loading
    # the framework and any gems in your application.
  end
end

Так что это происходит во всех моих проектах.Не уверен, что я сделал, я специально ничего не менял.
Вот полное сообщение об ошибке, которое я получаю:

"C:\Program Files\JetBrains\RubyMine 2018.2.2\bin\runnerw.exe" C:\Ruby24-x64\bin\ruby.exe C:/Users/Raja/RubymineProjects/JustinProject/bin/rails server -b 127.0.0.1 -p 3000 -e development
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.2.1/lib/rails/engine.rb:589:in `block in <class:Engine>': undefined method `railties_load_path' for nil:NilClass (NoMethodError)
    from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.2.1/lib/rails/initializable.rb:32:in `instance_exec'
    from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.2.1/lib/rails/initializable.rb:32:in `run'
    from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.2.1/lib/rails/initializable.rb:61:in `block in run_initializers'
    from C:/Ruby24-x64/lib/ruby/2.4.0/tsort.rb:228:in `block in tsort_each'
    from C:/Ruby24-x64/lib/ruby/2.4.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
    from C:/Ruby24-x64/lib/ruby/2.4.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
    from C:/Ruby24-x64/lib/ruby/2.4.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
    from C:/Ruby24-x64/lib/ruby/2.4.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
    from C:/Ruby24-x64/lib/ruby/2.4.0/tsort.rb:431:in `each_strongly_connected_component_from'
    from C:/Ruby24-x64/lib/ruby/2.4.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
    from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.2.1/lib/rails/initializable.rb:50:in `each'
    from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.2.1/lib/rails/initializable.rb:50:in `tsort_each_child'
    from C:/Ruby24-x64/lib/ruby/2.4.0/tsort.rb:415:in `call'
    from C:/Ruby24-x64/lib/ruby/2.4.0/tsort.rb:415:in `each_strongly_connected_component_from'
    from C:/Ruby24-x64/lib/ruby/2.4.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
    from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.2.1/lib/rails/initializable.rb:50:in `each'
    from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.2.1/lib/rails/initializable.rb:50:in `tsort_each_child'
    from C:/Ruby24-x64/lib/ruby/2.4.0/tsort.rb:415:in `call'
    from C:/Ruby24-x64/lib/ruby/2.4.0/tsort.rb:415:in `each_strongly_connected_component_from'
    from C:/Ruby24-x64/lib/ruby/2.4.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
    from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.2.1/lib/rails/initializable.rb:50:in `each'
    from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.2.1/lib/rails/initializable.rb:50:in `tsort_each_child'
    from C:/Ruby24-x64/lib/ruby/2.4.0/tsort.rb:415:in `call'
    from C:/Ruby24-x64/lib/ruby/2.4.0/tsort.rb:415:in `each_strongly_connected_component_from'
    from C:/Ruby24-x64/lib/ruby/2.4.0/tsort.rb:349:in `block in each_strongly_connected_component'
    from C:/Ruby24-x64/lib/ruby/2.4.0/tsort.rb:347:in `each'
    from C:/Ruby24-x64/lib/ruby/2.4.0/tsort.rb:347:in `call'
    from C:/Ruby24-x64/lib/ruby/2.4.0/tsort.rb:347:in `each_strongly_connected_component'
    from C:/Ruby24-x64/lib/ruby/2.4.0/tsort.rb:226:in `tsort_each'
    from C:/Ruby24-x64/lib/ruby/2.4.0/tsort.rb:205:in `tsort_each'
    from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.2.1/lib/rails/initializable.rb:60:in `run_initializers'
    from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.2.1/lib/rails/application.rb:361:in `initialize!'
    from C:/Users/Raja/RubymineProjects/JustinProject/config/environment.rb:5:in `<top (required)>'
    from config.ru:3:in `require_relative'
    from config.ru:3:in `block in <main>'
    from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/rack-2.0.6/lib/rack/builder.rb:55:in `instance_eval'
    from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/rack-2.0.6/lib/rack/builder.rb:55:in `initialize'
    from config.ru:in `new'
    from config.ru:in `<main>'
    from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/rack-2.0.6/lib/rack/builder.rb:49:in `eval'
    from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/rack-2.0.6/lib/rack/builder.rb:49:in `new_from_string'
    from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/rack-2.0.6/lib/rack/builder.rb:40:in `parse_file'
    from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/rack-2.0.6/lib/rack/server.rb:319:in `build_app_and_options_from_config'
    from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/rack-2.0.6/lib/rack/server.rb:219:in `app'
    from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.2.1/lib/rails/commands/server/server_command.rb:27:in `app'
    from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/rack-2.0.6/lib/rack/server.rb:354:in `wrapped_app'
    from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.2.1/lib/rails/commands/server/server_command.rb:89:in `log_to_stdout'
    from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.2.1/lib/rails/commands/server/server_command.rb:51:in `start'
    from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.2.1/lib/rails/commands/server/server_command.rb:147:in `block in perform'
    from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.2.1/lib/rails/commands/server/server_command.rb:142:in `tap'
    from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.2.1/lib/rails/commands/server/server_command.rb:142:in `perform'
    from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
    from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
    from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
    from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.2.1/lib/rails/command/base.rb:65:in `perform'
    from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.2.1/lib/rails/command.rb:46:in `invoke'
    from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.2.1/lib/rails/commands.rb:18:in `<top (required)>'
    from C:/Users/Raja/RubymineProjects/JustinProject/bin/rails:4:in `require'
    from C:/Users/Raja/RubymineProjects/JustinProject/bin/rails:4:in `<main>'
=> Booting Puma
=> Rails 5.2.2.1 application starting in development 
=> Run `rails server -h` for more startup options
Exiting
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...