gpt4 book ai didi

ruby-on-rails - actionview-4.2.4 - 未初始化的常量 ActionView::Helpers::ActiveModelHelper (NameError)

转载 作者:数据小太阳 更新时间:2023-10-29 08:44:46 28 4
gpt4 key购买 nike

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 答案,但我找不到任何可以修复我的错误的具体内容。

我尝试重新安装较低版本的 railites gem,但同样的错误不断出现。我尝试重新安装所有抛出错误的 gem,但问题似乎并没有消失。许多文章指出这是一个兼容性问题。但是当我尝试重新安装较低版本的 railties gem(4.0.0) 时,命令提示符仍然要求我升级到最新版本以便继续。我还安装了“Passenger”网络服务器来检查兼容性,并弹出了一个类似的错误,但这次是 passenger gem。请相应地对此进行调查。我也在 gem 文件下面复制。

# 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]

最佳答案

我记得是这样修复这个错误的:

  1. 卸载 railties gem。

  2. 然后安装旧版本的 rails gem(在我的例子中是 4.0.0,因为那是教程中的版本)。

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

您是否尝试过这些步骤?

关于ruby-on-rails - actionview-4.2.4 - 未初始化的常量 ActionView::Helpers::ActiveModelHelper (NameError),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32879550/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com