Reputation: 11
Devise has redirect functionality allowing user to return to the page he was on before logging in.
The problem is it only works with GETs. If the user was stopped for authentication during a POST (e.g. filling out a form) he will be redirected accordingly but with a GET.
Is there any way to change this so the POST is completed correctly?
Many thanks.
Upvotes: 0
Views: 1260
Reputation: 53
You can redirect to a POST action, with the help of the repost
gem.
See the full solution here: Devise redirect after sign_in and perfom POST action
Upvotes: 1
Reputation: 275
Make sure u have _links.erb file in C:\Ruby192\lib\ruby\gems\1.9.1\gems\devise-1.1.5\app\views\devise\shared(path may vary) with the following content .
<%- if controller_name != 'sessions' %>
<%= link_to "Sign in", new_session_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %> <br />
<% end -%>
Hope u get the solution.
Upvotes: 0