ruby on rails - Devise destroy_session_path not working rails4 -


i'm new rails appreciated. can't seem figure out doing wrong.

i have set gem devise , trying use 'logout route path' not working.

any appreciated. many thanks

error message in console

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 "/userrs/sign_out" 127.0.0.1 @ 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) 

my schema

activerecord::schema.define(version: 20150317223638)    create_table "userrs", force: true |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 

my views

  <div>     <span>hi <%= current_userr.email %></span>     <span>would <%= link_to 'view account', recruiters_path %></span>      <span>not <%= current_userr.email %>?</span>     <span><%= link_to 'log out', destroy_userr_session_path %></span>   </div> 

routes

new_userr_session    /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    /userrs/password/new(.:format)  devise/passwords#new       edit_userr_password    /userrs/password/edit(.:format) devise/passwords#edit                           patch  /userrs/password(.:format)      devise/passwords#update                           put    /userrs/password(.:format)      devise/passwords#update cancel_userr_registration    /userrs/cancel(.:format)        devise/registrations#cancel        userr_registration post   /userrs(.:format)               devise/registrations#create    new_userr_registration    /userrs/sign_up(.:format)       devise/registrations#new   edit_userr_registration    /userrs/edit(.:format)          devise/registrations#edit                           patch  /userrs(.:format)               devise/registrations#update                           put    /userrs(.:format)               devise/registrations#update                           delete /userrs(.:format)               devise/registrations#destroy 

in error message, link linking get action of "/userrs/sign_out" (btw, spelled right?). need have direct delete action instead. change code to:

<%= link_to 'log out', destroy_userr_session_path, method: :delete %> 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -