1

How to add a button in Active Admin that behaves similar to the browser's back button.

Thanks.

MrGreen
  • 479
  • 4
  • 24
  • 1
    Possible duplicate of [Link back to page visited before form](https://stackoverflow.com/questions/16213176/link-back-to-page-visited-before-form) – Pavel Oganesyan Dec 08 '17 at 15:48
  • 1
    actually its not a duplicate.. adding a Back button in active admin is not as easy as it seems – Alfie Dec 08 '17 at 21:23

1 Answers1

1

This is a working solution i'm currently using :

ActiveAdmin.register User do
  action_item 'Back', only: :index do
    link_to('Back', :back)
  end
end
Alfie
  • 2,706
  • 1
  • 14
  • 28
  • Thanks. I am adding this to every resource file. However, It is going in a circle. For example, If I visit the following `Users => Clients`, then if I keep clicking `Back` the browser will jump back and forth between these two pages. – MrGreen Dec 10 '17 at 22:57
  • Hmm, just curious. Try the same using the browser back button and see how it behaves – Alfie Dec 11 '17 at 03:07
  • The browser's back button behaves differently. So `Dashboard => Users => Clients` then pressing the browser's back button would be like `Clients => Users => Dashboard` while the `action_item`'s back would go back and forth between `Clients` and `Users` – MrGreen Dec 11 '17 at 15:58