我正在将rails 3.2升级到rails 4,因为我按照升级文档更改了配置使用设计3.0.4和rails 4.0.0添加了强参数的设计配置,这是我登陆后面临的错误
Started POST "/login" for 127.0.0.1
Processing by Devise::SessionsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"ws3EuyrD5HpafaEe1+/n5MQFPF1xqn4tyIHqkga248A=", "user"=>{"username"=>"tony_test", "password"=>"[FILTERED]"}, "commit"=>"Sign in"}
Completed 401 Unauthorized in 15ms
Processing by Devise::SessionsController#new as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"ws3EuyrD5HpafaEe1+/n5MQFPF1xqn4tyIHqkga248A=", "user"=>{"username"=>"tony_test", "password"=>"[FILTERED]"}, "commit"=>"Sign in"}
Completed 500 Internal Server Error in 12ms
ArgumentError (wrong number of arguments (2 for 1)):
activerecord (4.0.0) lib/active_record/attribute_assignment.rb:14:in `assign_attributes'
attr_encrypted (1.3.4) lib/attr_encrypted/adapters/active_record.rb:28:in `perform_attribute_assignment'
attr_encrypted (1.3.4) lib/attr_encrypted/adapters/active_record.rb:35:in `assign_attributes_with_attr_encrypted'
protected_attributes (1.0.3) lib/active_record/mass_assignment_security/core.rb:16:in `initialize'
activerecord (4.0.0) lib/active_record/inheritance.rb:27:in `new'
activerecord (4.0.0) lib/active_record/inheritance.rb:27:in `new'
devise (3.0.4) app/controllers/devise/sessions_controller.rb:8:in `new'
actionpack (4.0.0) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.0.0) lib/abstract_controller/base.rb:189:in `process_action'
actionpack (4.0.0) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.0.0) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (4.0.0) lib/active_support/callbacks.rb:444:in `block in _run__311658657__process_action__callbacks'
activesupport (4.0.0) lib/active_support/callbacks.rb:215:in `_conditional_callback_around_23'
activesupport (4.0.0) lib/active_support/callbacks.rb:433:in `_run__311658657__process_action__callbacks'
activesupport (4.0.0) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.0) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (4.0.0) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
activesupport (4.0.0) lib/active_support/notifications.rb:159:in `block in instrument'
activesupport (4.0.0) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.0.0) lib/active_support/notifications.rb:159:in `instrument'
actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.0.0) lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
activerecord (4.0.0) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.0.0) lib/abstract_controller/base.rb:136:in `process'
actionpack (4.0.0) lib/abstract_controller/rendering.rb:44:in `process'
actionpack (4.0.0) lib/action_controller/metal.rb:195:in `dispatch'
actionpack (4.0.0) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.0.0) lib/action_controller/metal.rb:231:in `block in action'
devise (3.0.4) lib/devise/failure_app.rb:51:in `call'
devise (3.0.4) lib/devise/failure_app.rb:51:in `recall'
devise (3.0.4) lib/devise/failure_app.rb:35:in `respond'
actionpack (4.0.0) lib/abstract_controller/base.rb:189:in `process_action'
actionpack (4.0.0) lib/abstract_controller/base.rb:136:in `process'
actionpack (4.0.0) lib/action_controller/metal.rb:195:in `dispatch'
actionpack (4.0.0) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.0.0) lib/action_controller/metal.rb:231:in `block in action'
devise (3.0.4) lib/devise/failure_app.rb:20:in `call'
devise (3.0.4) lib/devise/failure_app.rb:20:in `call'
devise (3.0.4) lib/devise/delegator.rb:5:in `call'
warden (1.2.3) lib/warden/manager.rb:130:in `call_failure_app'
warden (1.2.3) lib/warden/manager.rb:116:in `process_unauthenticated'
warden (1.2.3) lib/warden/manager.rb:47:in `call'
rack (1.5.5) lib/rack/etag.rb:23:in `call'
rack (1.5.5) lib/rack/conditionalget.rb:35:in `call'
rack (1.5.5) lib/rack/head.rb:11:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/flash.rb:241:in `call'
rack (1.5.5) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.5.5) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/cookies.rb:486:in `call'
activerecord (4.0.0) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.0.0) lib/active_support/callbacks.rb:373:in `_run__99626786__call__callbacks'
activesupport (4.0.0) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/reloader.rb:64:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.0.0) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.0.0) lib/rails/rack/logger.rb:21:in `block in call'
activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `block in tagged'
activesupport (4.0.0) lib/active_support/tagged_logging.rb:25:in `tagged'
activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `tagged'
railties (4.0.0) lib/rails/rack/logger.rb:21:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.5) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.5) lib/rack/runtime.rb:17:in `call'
activesupport (4.0.0) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
rack (1.5.5) lib/rack/lock.rb:17:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/static.rb:64:in `call'
railties (4.0.0) lib/rails/engine.rb:511:in `call'
railties (4.0.0) lib/rails/application.rb:97:in `call'
rack (1.5.5) lib/rack/content_length.rb:14:in `call'
thin (1.5.1) lib/thin/connection.rb:81:in `block in pre_process'
thin (1.5.1) lib/thin/connection.rb:79:in `catch'
thin (1.5.1) lib/thin/connection.rb:79:in `pre_process'
thin (1.5.1) lib/thin/connection.rb:54:in `process'
thin (1.5.1) lib/thin/connection.rb:39:in `receive_data'
eventmachine (1.0.8) lib/eventmachine.rb:193:in `run_machine'
eventmachine (1.0.8) lib/eventmachine.rb:193:in `run'
thin (1.5.1) lib/thin/backends/base.rb:63:in `start'
thin (1.5.1) lib/thin/server.rb:159:in `start'
rack (1.5.5) lib/rack/handler/thin.rb:16:in `run'
rack (1.5.5) lib/rack/server.rb:264:in `start'
railties (4.0.0) lib/rails/commands/server.rb:84:in `start'
railties (4.0.0) lib/rails/commands.rb:78:in `block in <top (required)>'
railties (4.0.0) lib/rails/commands.rb:73:in `tap'
railties (4.0.0) lib/rails/commands.rb:73:in `<top (required)>'
script/rails:6:in `require'
script/rails:6:in `<main>'
Rendered /home/jagdish/.rvm/gems/ruby-2.0.0-p643/gems/actionpack-4.0.0/lib/action_dispatch/middleware/templates/rescues/_source.erb (3.3ms)
Rendered /home/jagdish/.rvm/gems/ruby-2.0.0-p643/gems/actionpack-4.0.0/lib/action_dispatch/middleware/templates/rescues/_trace.erb (10.5ms)
Rendered /home/jagdish/.rvm/gems/ruby-2.0.0-p643/gems/actionpack-4.0.0/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (9.0ms)
Rendered /home/jagdish/.rvm/gems/ruby-2.0.0-p643/gems/actionpack-4.0.0/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (240.8ms)
请告诉我如何解决此问题。
先谢谢
杰格迪什
答案 0 :(得分:0)
此链接可能会对您有所帮助:https://github.com/attr-encrypted/attr_encrypted/issues/107#issuecomment-73948458。
链接说:
修改您的Gemfile,如下所示:
require 'attr_encrypted', require: false
然后在Rails初始化过程中要求attr_encrypted。
echo "require 'attr_encrypted'" >> config/application.rb