我是铁杆新手,所以任何帮助都会非常感激。我似乎无法弄清楚我做错了什么。
我已经成功设置了GEM设计,我正在尝试使用无法正常工作的“注销路径”。
任何帮助都会非常感激。非常感谢
控制台中的错误消息
railties (4.1.6) lib/rails/application.rb:144:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
rack (1.5.2) lib/rack/content_length.rb:14:in `call'
rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
/Users/ARTLoe/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
/Users/ARTLoe/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
/Users/ARTLoe/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'
Rendered /Users/ARTLoe/.rvm/gems/ruby-2.1.2/gems/web-console-2.0.0.beta3/lib/action_dispatch/templates/rescues/_trace.html.erb (3.6ms)
Rendered /Users/ARTLoe/.rvm/gems/ruby-2.1.2/gems/web-console-2.0.0.beta3/lib/action_dispatch/templates/rescues/routing_error.html.erb within rescues/layout (27.6ms)
Started GET "/userrs/sign_out" for 127.0.0.1 at 2015-03-28 14:18:13 +0000
ActionController::RoutingError (No route matches [GET] "/userrs/sign_out"):
web-console (2.0.0.beta3) lib/action_dispatch/debug_exceptions.rb:22:in `middleware_call'
web-console (2.0.0.beta3) lib/action_dispatch/debug_exceptions.rb:13:in `call'
actionpack (4.1.6) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.1.6) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.1.6) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.1.6) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.1.6) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.1.6) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.1.6) lib/rails/rack/logger.rb:20:in `call'
quiet_assets (1.1.0) lib/quiet_assets.rb:27:in `call_with_quiet_assets'
actionpack (4.1.6) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.2) lib/rack/runtime.rb:17:in `call'
activesupport (4.1.6) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
actionpack (4.1.6) lib/action_dispatch/middleware/static.rb:64:in `call'
rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
railties (4.1.6) lib/rails/engine.rb:514:in `call'
railties (4.1.6) lib/rails/application.rb:144:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
rack (1.5.2) lib/rack/content_length.rb:14:in `call'
rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
/Users/ARTLoe/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
/Users/ARTLoe/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
/Users/ARTLoe/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'
Rendered /Users/ARTLoe/.rvm/gems/ruby-2.1.2/gems/web-console-2.0.0.beta3/lib/action_dispatch/templates/rescues/_trace.html.erb (1.6ms)
Rendered /Users/ARTLoe/.rvm/gems/ruby-2.1.2/gems/web-console-2.0.0.beta3/lib/action_dispatch/templates/rescues/routing_error.html.erb within rescues/layout (22.9ms)
我的架构
ActiveRecord::Schema.define(version: 20150317223638) do
create_table "userrs", force: true do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "userrs", ["email"], name: "index_userrs_on_email", unique: true
add_index "userrs", ["reset_password_token"], name: "index_userrs_on_reset_password_token", unique: true
end
我的观点
<div>
<span>hi <%= current_userr.email %></span>
<span>would you like to <%= link_to 'view your account', recruiters_path %></span>
<span>not <%= current_userr.email %>?</span>
<span><%= link_to 'log out', destroy_userr_session_path %></span>
</div>
路由
new_userr_session GET /userrs/sign_in(.:format) devise/sessions#new
userr_session POST /userrs/sign_in(.:format) devise/sessions#create
destroy_userr_session DELETE /userrs/sign_out(.:format) devise/sessions#destroy
userr_password POST /userrs/password(.:format) devise/passwords#create
new_userr_password GET /userrs/password/new(.:format) devise/passwords#new
edit_userr_password GET /userrs/password/edit(.:format) devise/passwords#edit
PATCH /userrs/password(.:format) devise/passwords#update
PUT /userrs/password(.:format) devise/passwords#update
cancel_userr_registration GET /userrs/cancel(.:format) devise/registrations#cancel
userr_registration POST /userrs(.:format) devise/registrations#create
new_userr_registration GET /userrs/sign_up(.:format) devise/registrations#new
edit_userr_registration GET /userrs/edit(.:format) devise/registrations#edit
PATCH /userrs(.:format) devise/registrations#update
PUT /userrs(.:format) devise/registrations#update
DELETE /userrs(.:format) devise/registrations#destroy
答案 0 :(得分:1)
在您的错误消息中,您的链接链接到GET
的{{1}}操作(顺便说一下,拼写正确吗?)。您需要将其直接指向"/userrs/sign_out"
操作。所以将代码更改为:
DELETE