Reputation: 1381
Why my redirect_to :back
doesn't work? it just redirect to the same page.
my method
controller do
def update
update! do |success, failure|
success.html { redirect_to :back }
end
end
end
my request.referer
returns me my current path
Upvotes: 1
Views: 2197
Reputation: 188
I found that the following works:
redirect_backwards_or_to_root
Rails 6, ActiveAdmin 2.7
Upvotes: 1
Reputation: 2351
I had good success in my use case url_for(:back)
. I specifically used it like this, but I would guess it works in other places
form do |f|
f.actions do
f.action :submit
f.cancel_link(url_for(:back))
end
end
Upvotes: 3
Reputation: 188
I know this is old. I was trying to solve the same issue. And found the way to do it. So I share it here.
Based on this code in here
This is how we do redirect back in ActiveAdmin
ActiveAdmin::Dependency.rails.redirect_back self, active_admin_root
Hope that help.
Upvotes: 0