更新到rails 5.1后,在本地运行服务器上,它给出了下面提到的错误,我检查了所有地方,但我没有找到任何解决方案。我也在从所有代码中过滤之前删除了但仍然会出现此错误。
Gem Load Error is: undefined method `before_filter' for ActionController::Base:Class
Did you mean? before_action
Backtrace for gem load error is:
/home/affi/.rvm/gems/ruby-2.3.1/gems/ie_iframe_cookies-0.2.0/lib/ie_iframe_cookies.rb:5:in `<class:Base>'
/home/affi/.rvm/gems/ruby-2.3.1/gems/ie_iframe_cookies-0.2.0/lib/ie_iframe_cookies.rb:4:in `<module:ActionController>'
/home/affi/.rvm/gems/ruby-2.3.1/gems/ie_iframe_cookies-0.2.0/lib/ie_iframe_cookies.rb:3:in `<top (required)>'
/home/affi/.rvm/gems/ruby-2.3.1/gems/bundler-1.14.6/lib/bundler/runtime.rb:91:in `require'
/home/affi/.rvm/gems/ruby-2.3.1/gems/bundler-1.14.6/lib/bundler/runtime.rb:91:in `block (2 levels) in require'
/home/affi/.rvm/gems/ruby-2.3.1/gems/bundler-1.14.6/lib/bundler/runtime.rb:86:in `each'
/home/affi/.rvm/gems/ruby-2.3.1/gems/bundler-1.14.6/lib/bundler/runtime.rb:86:in `block in require'
/home/affi/.rvm/gems/ruby-2.3.1/gems/bundler-1.14.6/lib/bundler/runtime.rb:75:in `each'
/home/affi/.rvm/gems/ruby-2.3.1/gems/bundler-1.14.6/lib/bundler/runtime.rb:75:in `require'
/home/affi/.rvm/gems/ruby-2.3.1/gems/bundler-1.14.6/lib/bundler.rb:107:in `require'
/home/affi/officeData/evercam-devops/evercam-dashboard/config/application.rb:12:in `<top (required)>'
/home/affi/.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/rails/commands/server/server_command.rb:128:in `require'
/home/affi/.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/rails/commands/server/server_command.rb:128:in `block in perform'
/home/affi/.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/rails/commands/server/server_command.rb:125:in `tap'
/home/affi/.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/rails/commands/server/server_command.rb:125:in `perform'
/home/affi/.rvm/gems/ruby-2.3.1/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
/home/affi/.rvm/gems/ruby-2.3.1/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
/home/affi/.rvm/gems/ruby-2.3.1/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
/home/affi/.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/rails/command/base.rb:63:in `perform'
/home/affi/.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/rails/command.rb:44:in `invoke'
/home/affi/.rvm/gems/ruby-2.3.1/gems/railties- 5.1.0/lib/rails/commands.rb:16:in `<top (required)>'
bin/rails:8:in `require'
bin/rails:8:in `<main>'
Bundler Error Backtrace:
from /home/affi/.rvm/gems/ruby-2.3.1/gems/bundler- 1.14.6/lib/bundler/runtime.rb:90:in `block (2 levels) in require'
from /home/affi/.rvm/gems/ruby-2.3.1/gems/bundler-1.14.6/lib/bundler/runtime.rb:86:in `each'
from /home/affi/.rvm/gems/ruby-2.3.1/gems/bundler-1.14.6/lib/bundler/runtime.rb:86:in `block in require'
from /home/affi/.rvm/gems/ruby-2.3.1/gems/bundler-1.14.6/lib/bundler/runtime.rb:75:in `each'
from /home/affi/.rvm/gems/ruby-2.3.1/gems/bundler-1.14.6/lib/bundler/runtime.rb:75:in `require'
from /home/affi/.rvm/gems/ruby-2.3.1/gems/bundler-1.14.6/lib/bundler.rb:107:in `require'
from /home/affi/officeData/evercam-devops/evercam-dashboard/config/application.rb:12:in `<top (required)>'
from /home/affi/.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/rails/commands/server/server_command.rb:128:in `require'
from /home/affi/.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/rails/commands/server/server_command.rb:128:in `block in perform'
from /home/affi/.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/rails/commands/server/server_command.rb:125:in `tap'
from /home/affi/.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/rails/commands/server/server_command.rb:125:in `perform'
from /home/affi/.rvm/gems/ruby-2.3.1/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
from /home/affi/.rvm/gems/ruby-2.3.1/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
from /home/affi/.rvm/gems/ruby-2.3.1/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
from /home/affi/.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/rails/command/base.rb:63:in `perform'
from /home/affi/.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/rails/command.rb:44:in `invoke'
from /home/affi/.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/rails/commands.rb:16:in `<top (required)>'
from bin/rails:8:in `require'
from bin/rails:8:in `<main>'
这是我的gem文件,'Bundle Install'正常运行。
source 'https://rubygems.org'
ruby '2.3.1'
gem 'rails', '~> 5.1'
gem 'railties', '~> 5.1'
gem 'sass-rails'
gem 'yui-compressor'
gem 'uglifier'
gem 'coffee-rails'
gem 'jquery-rails'
gem 'sprockets'
gem 'javascript-securehash-rails'
gem 'fog'
gem 'asset_sync'
gem 'autoprefixer-rails'
gem 'stripe',
github: 'stripe/stripe-ruby'
gem 'stripe_event'
gem 'nprogress-rails'
gem 'turbolinks'
gem 'georuby'
gem 'geocoder'
gem 'hashie'
gem 'timezone'
gem 'pg'
gem 'sequel'
gem 'bcrypt', '~> 3.1.10'
gem 'protected_attributes_continued'
gem 'rack-rewrite'
gem 'typhoeus'
gem 'puma'
gem 'data_uri'
gem 'country_select',
github: 'stefanpenner/country_select'
gem "devise",
git: 'https://github.com/plataformatec/devise.git'
gem 'ie_iframe_cookies'
gem 'heroku-api'
gem 'intercom-rails'
gem 'wicked_pdf'
gem 'wkhtmltopdf-binary'
gem 'intercom', require: 'intercom'
gem 'imgareaselect-rails', '~> 1.0'
gem 'dotenv'
group :evercam do
gem 'evercam',
github: 'evercam/evercam-ruby'
end
group :production do
gem 'rails_12factor'
gem 'newrelic_rpm'
gem 'wkhtmltopdf-heroku'
gem 'heroku-deflater',
git: "https://github.com/romanbsd/heroku-deflater.git"
end
group :development do
# gem 'jazz_hands',
# github: 'nixme/jazz_hands',
# branch: 'bring-your-own-debugger'
gem 'pry-byebug'
gem 'rspec'
gem 'guard-rspec'
end
group :test do
gem 'database_cleaner'
gem 'factory_girl'
gem 'vcr'
gem 'rspec-rails'
gem 'webmock'
gem 'poltergeist'
gem 'nokogiri'
gem 'simplecov'
gem 'rack_session_access'
gem 'selenium-webdriver'
gem 'launchy'
gem 'codeclimate-test-reporter', require: nil
end
source 'https://rails-assets.org' do
gem 'rails-assets-bootbox'
gem 'rails-assets-bootstrap'
gem 'rails-assets-bootstrap-datepicker'
gem 'rails-assets-bootstrap-tabdrop'
gem 'rails-assets-datatables'
gem 'rails-assets-datatables-plugins'
gem 'rails-assets-datetimepicker'
gem 'rails-assets-fullcalendar'
gem 'rails-assets-iCheck'
gem 'rails-assets-jquery-cookie'
gem 'rails-assets-moment', '~> 2.12.0'
gem 'rails-assets-jquery-form-validator'
gem 'rails-assets-jquery.browser'
gem 'rails-assets-jquery.nicescroll'
gem 'rails-assets-jquery.slimscroll'
gem 'rails-assets-jquery.uniform'
gem 'rails-assets-ladda'
gem 'rails-assets-screenfull'
gem 'rails-assets-videojs'
gem 'rails-assets-bs-slider'
gem 'rails-assets-bootstrap-toggle'
gem 'rails-assets-select2'
gem 'rails-assets-jquery-tags-input'
end
答案 0 :(得分:0)
我认为这是before_filter
问题,before_filter
已在rails 5.1中删除
您应该使用before_action
代替before_filter
答案 1 :(得分:0)
before_filter
已被弃用,并且不会在rails 5中工作。此外,看起来宝石也是&#34;已弃用/未维护&#34;。您可以尝试分配回购并将所有before_filter
更改为before_action
。然后将repo添加到gemfile中;但是,没有任何保证可行。