Log Out won't work correctly
I had a fairly simple setup for authentication that was working but wanted to add a remember me radio button. Since adding the radion button, adding a column called Auth_Token to my DB and using it to store cookies I can't seem to get my log out button to actually log the user out.
I keep receiving the following message:
ArgumentError in SessionsController#destroy
wrong number of arguments (0 for 1)
My setup is as follows:
class SessionsController < ApplicationController
user = User.find_by_email(params[:email])
if user && user.authenticate(params[:password])
flash.now.alert = "Invalid email or password!"
Relevant element of my pages#home page:
class ApplicationController < ActionController::Base
@current_user ||= User.find_by_auth_token!(cookies[:auth_token]) if cookies[:auth_token]
<li><% if :current_user %>
<!-- user is logged in -->
<%= link_to "Logout", logout_path %>
<% else %>
<!-- user is not logged in -->
<%= link_to "Login", login_path %>
<%= link_to "Sign up", signup_path %>
<% end %></li>
I can't seem to work out at all how to the log out button to work correctly and also ensure that in Pages#Home Logout is shown if a user is logged in and Log in/ Sign up is shown if a user isn't logged in.
get "logout" => "sessions#destroy"
controller :pages do
get "home" => "pages#home"
get "about" => "pages#about"
get "contact" => "pages#contact"
controller :user do
get "signup" => "user#new"
resources :users, :controller => 'user'
controller :sessions do
get "login" => "sessions#new"
post "login" => "sessions#create"
delete "logout" => "sessions#destroy"
root :to => "pages#home"
Any help people can offer really would be much appreciated.
Thanks in Advance,