Reputation: 25
I'm having issues with my rails app when i deploy it to heroku. I'm using steam-omniauth. The log out function works correctly on my machine, but won't work when deployed. Clicking the logout link transfers me to a 404 screen and this error message in the log. looks like its trying to use 'get' for some reason. I've also made sure to rake my db, and pushed the latest versions through to heroku. I'm kind of out of ideas.
at=info method=GET path="/logout" host=warm-sands-60002.herokuapp.com request_id=d01b9d02-238f-41f6-a894-0e74bf64a1c0 fwd="98.169.0.136" dyno=web.1 connect=1ms service=6ms status=404 bytes=1902 protocol=https`
my destroy action in the sessions_controller
def destroy
if current_user
session.delete(:user_id)
flash[:success] = "Goodbye!"
redirect_to root_path
end
end
sessions helper
def current_user
if cookies[:remember_token].present?
@current_user ||= User.find_by_remember_token(cookies[:remember_token])
end
end
routes
match '/auth/:provider/callback', to: 'sessions#create', via: :all
delete '/logout', to: 'sessions#destroy'
and my logout link
<li class="nav-item"><%= link_to 'Log Out', logout_path, method: :delete %></li>
if theres anything i can provide let me know. this is pretty frustrating.
Upvotes: 0
Views: 106
Reputation: 3475
Per your log message, the logout action is being submitted with a GET
instead of a DELETE
method. It looks like your logout link is using UJS.
If it's working locally in dev, but not when deployed, it's probably because your javascript isn't compiling correctly, served correctly, or being loaded correctly. Look at your browser developer console to see if anything is being logged there.
Upvotes: 1