【发布时间】:2015-07-14 02:53:25
【问题描述】:
当我尝试在我的 Rails 中运行任何 rake 测试时,它会给我错误消息“未定义的方法 `whitelist_attributes”。我不知道它为什么会来。
我得到的错误是:
NoMethodError: undefined method `whitelist_attributes=' for # <Class:0x50de7d8>
C:/Users/Arvind/project/book/config/initializers/devise.rb:21:in `block in <top (required)>'
C:/Users/Arvind/project/book/config/initializers/devise.rb:4:in `<top (required)>'
C:/Users/Arvind/project/book/config/environment.rb:8:in `<top (required)>'
Tasks: TOP => environment
(See full trace by running task with --trace)`enter code here`
我的 gem 文件如下所示:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.1'
# Use sqlite3 as the database for Active Record
gem 'devise'
gem 'protected_attributes'
gem 'simple_form'
gem 'state_machine', :git => 'https://github.com/seuros/state_machine.git'
gem 'draper', '~> 2.1'
gem 'js-routes'
gem 'paperclip', :git => "git://github.com/thoughtbot/paperclip.git"
gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter- bootstrap-rails.git'
gem 'will_paginate'
gem 'bootstrap-will_paginate'
gem 'private_pub'
gem 'foreman'
gem 'bootstrap-sass', :git => 'git://github.com/thomas-mcdonald/bootstrap-sass.git'
gem 'font-awesome-less'
gem 'faye'
group :development do
gem 'thin'
end
group :test do
gem 'shoulda'
gem 'factory_girl_rails'
end
group :development do
gem 'sqlite3'
gem 'log_buddy'
end
group :production do
gem 'pg'
end
gem 'rails_12factor', group: :production
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# 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'
# 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]
谢谢!
【问题讨论】:
标签: ruby-on-rails ruby gem asset-pipeline