2015-08-01 2 views
2

Я начал этот учебник для Rails. Я только что создал приложение и собирается проверить страницу приветствия по умолчанию, и это произошло:NameError при выполнении 'rails s'

D:\Programming\Rails Projects\simpleCMS>rails server 
    C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.3/lib/action_view/helpers.rb:40:in `<module:Helpers>': uninitialized constant ActionView::Helpers::ActiveModelHelper (NameError) 
      from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.3/lib/action_view/helpers.rb:4:in `<module:ActionView>' 
      from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.3/lib/action_view/helpers.rb:3:in `<top (required)>' 
      from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.3/lib/action_view/base.rb:5:in `require' 
      from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.3/lib/action_view/base.rb:5:in `<top (required)>' 
      from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/template.rb:7:in `<class:Template>' 
      from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/template.rb:6:in `<module:WebConsole>' 
      from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/template.rb:1:in `<top (required)>' 
      from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console.rb:12:in `require' 
      from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console.rb:12:in `<top (required)>' 
      from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web-console.rb:1:in `require' 
      from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web-console.rb:1:in `<top (required)>' 
      from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `require' 
      from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require' 
      from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `each' 
      from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `block in require' 
      from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `each' 
      from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `require' 
      from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler.rb:134:in `require' 
      from D:/Programming/Rails Projects/simpleCMS/config/application.rb:7:in `<top (required)>' 
      from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:78:in `require' 
      from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:78:in `block in server' 
      from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:75:in `tap' 
      from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:75:in `server' 
      from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:39:in `run_command!' 
      from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/commands.rb:17:in `<top (required)>' 
      from bin/rails:4:in `require' 
      from bin/rails:4:in `<main>' 

Мой Gemfile (без комментариев):

source 'https://rubygems.org' 
gem 'rails', '4.2.3' 
gem 'mysql2' 
gem 'jbuilder', '~> 2.0' 
gem 'sdoc', '~> 0.4.0', group: :doc 
group :development, :test do 
    gem 'byebug' 
    gem 'web-console', '~> 2.0' 
end 
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 
+0

Что находится в строке 7 'config/application.rb'? –

+0

'Bundler.require (* Rails.groups)' –

+0

Попробуйте прокомментировать строку, поэтому она не будет запущена, и вместо этого добавьте эту строку: 'Bundler.require (: default, Rails.env)'. Не уверен, что это сработает, но ваш синтаксис звучит не очень хорошо для меня ... –

ответ

2

Uninstall railties камень, потому что просто удалить rails драгоценный камень д не работает. Затем установите более старую версию драгоценного камня rails (в моем случае это 4.0.0, потому что это было из тутотика).

Это устранило проблему.

-1

вам может понадобиться, чтобы связать адрес IP- почему вам не попробовать это: сервер рельсы -b ​​локальный

+0

Вам следует больше объяснить это решение. – Sweeper

+0

Я предположил, что он уже сделал db: migrate & db: seed поэтому он сделал сервер rails; я взял курс сааса онлайн, прежде чем вспомнить, что иногда в зависимости от того, где вы используете свое приложение, вам может потребоваться добавить «-b 127.0.0.1» (то есть локальный хост), однако, если вы используете cloud9 или закись азота, тогда это будет иначе, еще -b ### (некоторые ip адрес) здесь. достаточно ясно? –

+0

точно такая же ошибка, как и раньше –

Смежные вопросы