actionview-4.2.4-未初始化的常量ActionView :: Helpers :: ActiveModelHelper(NameError) [英] actionview-4.2.4 - uninitialized constant ActionView::Helpers::ActiveModelHelper (NameError)

查看:78
本文介绍了actionview-4.2.4-未初始化的常量ActionView :: Helpers :: ActiveModelHelper(NameError)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C:\Users\Clarion Smith\Documents\Sites\simple_cms>rails server
C:/Ruby22/lib/ruby/gems/2.2.0/gems/actionview-4.2.4/lib/action_view/helpers.rb:40:in `<module:Helpers>': uninitialized constant ActionView::Helpers::ActiveModelHelper (NameError)
        from C:/Ruby22/lib/ruby/gems/2.2.0/gems/actionview-4.2.4/lib/action_view/helpers.rb:4:in `<module:ActionView>'
        from C:/Ruby22/lib/ruby/gems/2.2.0/gems/actionview-4.2.4/lib/action_view/helpers.rb:3:in `<top (required)>'
        from C:/Ruby22/lib/ruby/gems/2.2.0/gems/actionview-

我的问题在Ruby和Rails中很常见.尽管我经历了不同的stackoverflow答案,但找不到任何可以解决错误的特定内容.

My problem is very common in Ruby and Rails. Though I went through different stackoverflow answers, I could not find anything specific which would fix my error.

我尝试重新安装较低版本的railites gem,但相同的错误不断弹出.我尝试重新安装所有引发错误的宝石,但问题似乎并没有消失.许多文章指出这是兼容性问题.但是,当我尝试重新安装较低版本的railties gem(4.0.0)时,命令提示符仍然要求我升级到最新版本以继续.我还安装了"Passenger" Web服务器,以检查兼容性,并且弹出了类似的错误,但这一次是乘客gem.请对此进行相应调查.我也在下面的gem文件中复制.

I tried reinstalling lower version of the railites gem but the same error keeps popping. I tried reinstalling all the gems that were throwing errors and still the problem doesnt seem to go away. Many articles indicated that this is a compatibility issue. But when I tried reinstalling a lower version of the railties gem(4.0.0), the command prompt still asked me to upgrade to the latest version in order to continue. I also installed 'Passenger' web server to check the compatibility and a similar error popped up but this time with the passenger gem. Please look into this accordingly. I am also copying below the gem file.

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.4'
# Use mysql as the database for Active Record
gem 'mysql2'
#Bundle for Passenge r web server
gem 'passenger'
# Use SCSS for stylesheets
#gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets

#gem 'uglifier', '>= 1.3.0'
gem 'rack', '~> 1.6.0'
gem 'rspec-rails', :group => [:development, :test]
# Use CoffeeScript for .coffee assets and views

#gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library

#gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks

#gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder

#gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.

#gem 'sdoc', '~> 0.4.0', group: :doc

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

推荐答案

我记得以这种方式解决此错误:

I remember fixing this error this way:

  1. 卸载railties gem.

然后安装rails gem的旧版本(在本例中为4.0.0,因为这是本教程中的版本).

Then install an older version of the rails gem (4.0.0 in my case because that was the one from the tutorial).

这一次为我解决了这个问题.

This fixed the issue for me once.

您尝试过这些步骤吗?

这篇关于actionview-4.2.4-未初始化的常量ActionView :: Helpers :: ActiveModelHelper(NameError)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆