I'm working on a cron task that e-mails out a link to download a CSV file from Active Admin. The link looks like something along the lines of:
www.adminsite.com/admin/records.csv
If the user isn't already authenticated into the system -- active admin redirects to the page that just says "You need to sign in or sign up before continuing." instead of redirecting to the login page and then following through with a CSV download link upon successful authentication.
I've tried looking into active admin internals, but have not been able to figure it out yet. Any ideas?
Thanks!
!!! EDIT !!!
I actually ended up solving this issue on my own.
Because the link I was generating was navigating to a csv format, I had to add in the :csv option as a navigational format to devise.rb configuration file:
config.navigational_formats = ["*/*", :html, :csv]
Now the redirect to the login page was working, but it was taking the user to /admin/login.csv, which was coming back as an empty page. I'm assuming there was no template for a csv format.
I had to set up the redirect from /admin/login.csv to /admin/login by adding this to the routes.rb file:
devise_for :admin_users, ActiveAdmin::Devise.config do
match "/admin/login.csv" => redirect("/admin/login")
end
Done.