我在尝试登录/注册我的gitorious服务器时收到此错误:
该网站正在http://gitorious.korvinszanto.me开始。
ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken):
vendor/rails/actionpack/lib/action_controller/request_forgery_protection.rb:79:in `verify_authenticity_token'
vendor/rails/activesupport/lib/active_support/callbacks.rb:178:in `send'
vendor/rails/activesupport/lib/active_support/callbacks.rb:178:in `evaluate_method'
vendor/rails/activesupport/lib/active_support/callbacks.rb:166:in `call'
vendor/rails/actionpack/lib/action_controller/filters.rb:225:in `call'
vendor/rails/actionpack/lib/action_controller/filters.rb:629:in `run_before_filters'
vendor/rails/actionpack/lib/action_controller/filters.rb:615:in `call_filters'
vendor/rails/actionpack/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17:in `ms'
vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
vendor/rails/actionpack/lib/action_controller/rescue.rb:160:in `perform_action_without_flash'
vendor/rails/actionpack/lib/action_controller/flash.rb:146:in `perform_action'
vendor/rails/actionpack/lib/action_controller/base.rb:532:in `send'
vendor/rails/actionpack/lib/action_controller/base.rb:532:in `process_without_filters'
vendor/rails/actionpack/lib/action_controller/filters.rb:606:in `process'
vendor/rails/actionpack/lib/action_controller/base.rb:391:in `process'
vendor/rails/actionpack/lib/action_controller/base.rb:386:in `call'
vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:437:in `call'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:87:in `dispatch'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:121:in `_call'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack'
vendor/rails/activerecord/lib/active_record/query_cache.rb:29:in `call'
vendor/rails/activerecord/lib/active_record/query_cache.rb:29:in `call'
vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
vendor/rails/activerecord/lib/active_record/query_cache.rb:9:in `cache'
vendor/rails/activerecord/lib/active_record/query_cache.rb:28:in `call'
vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
vendor/rails/actionpack/lib/action_controller/string_coercion.rb:25:in `call'
rack (1.0.1) lib/rack/head.rb:9:in `call'
rack (1.0.1) lib/rack/methodoverride.rb:24:in `call'
vendor/rails/actionpack/lib/action_controller/params_parser.rb:15:in `call'
vendor/rails/railties/lib/rails/rack/metal.rb:47:in `call'
vendor/rails/actionpack/lib/action_controller/session/cookie_store.rb:93:in `call'
vendor/rails/activesupport/lib/active_support/cache/strategy/local_cache.rb:24:in `call'
vendor/rails/actionpack/lib/action_controller/failsafe.rb:26:in `call'
rack (1.0.1) lib/rack/lock.rb:11:in `call'
rack (1.0.1) lib/rack/lock.rb:11:in `synchronize'
rack (1.0.1) lib/rack/lock.rb:11:in `call'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:106:in `call'
passenger (3.0.9) lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:106:in `call'
passenger (3.0.9) lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
passenger (3.0.9) lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'
passenger (3.0.9) lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
passenger (3.0.9) lib/phusion_passenger/classic_rails/application_spawner.rb:321:in `start_request_handler'
passenger (3.0.9) lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `send'
passenger (3.0.9) lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `handle_spawn_application'
passenger (3.0.9) lib/phusion_passenger/utils.rb:479:in `safe_fork'
passenger (3.0.9) lib/phusion_passenger/classic_rails/application_spawner.rb:270:in `handle_spawn_application'
passenger (3.0.9) lib/phusion_passenger/abstract_server.rb:357:in `__send__'
passenger (3.0.9) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
passenger (3.0.9) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
passenger (3.0.9) lib/phusion_passenger/abstract_server.rb:180:in `start'
passenger (3.0.9) lib/phusion_passenger/classic_rails/application_spawner.rb:149:in `start'
passenger (3.0.9) lib/phusion_passenger/spawn_manager.rb:219:in `spawn_rails_application'
passenger (3.0.9) lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
passenger (3.0.9) lib/phusion_passenger/spawn_manager.rb:214:in `spawn_rails_application'
passenger (3.0.9) lib/phusion_passenger/abstract_server_collection.rb:82:in `synchronize'
passenger (3.0.9) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
passenger (3.0.9) lib/phusion_passenger/spawn_manager.rb:213:in `spawn_rails_application'
passenger (3.0.9) lib/phusion_passenger/spawn_manager.rb:132:in `spawn_application'
passenger (3.0.9) lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
passenger (3.0.9) lib/phusion_passenger/abstract_server.rb:357:in `__send__'
passenger (3.0.9) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
passenger (3.0.9) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
passenger (3.0.9) helper-scripts/passenger-spawn-server:99
我该如何解决这个问题?
答案 0 :(得分:0)
在 application_controller.rb 中,请确保您的protect_from_forgery
位于顶部。
在 application.html.erb 布局中,请确保<%= csrf_meta_tags %>
也在那里。