There is a private method in the spree-auth-devise gem. The method is inside the controller UserSessionsController https://github.com/spree/spree_auth_devise/blob/master/lib/controllers/frontend/spree/user_sessions_controller.rb
I wish to override the function "redirect_back_or_default".
Is this possible?
Update
After mixing and matching between your answers and doing some googling, I arrived at this solution:
Spree::UserSessionsController.class_eval do
private
def redirect_back_or_default(default)
if default == "/admin/orders" or session["spree_user_return_to"] == "/admin/orders"
redirect_to("/admin/users")
else
redirect_to(session["spree_user_return_to"] || default)
end
session["spree_user_return_to"] = nil
end
end
And I have placed the script file in config/initializers.
Thank you all.