Hi there,
I’d like to know if there is a solution to the scenario when using
acts_as_authenticated and ajax:
I have an action in my controller which is protected by login via
acts_as_authenticated. Now, this action can be called both by human
interaction, as well as ajax requests. (It is an add to cart link). It
works great as long as I am in an authenticated session.
Now, I want to display this add to cart link regardless if I am logged
in or not (very important).
When I switch off Javascript, I get redirected nicely to the login
form when I click it.
With Javascript on, and thus ajax working, the ajax requests gets
redirected to the login form (which I can see in the server log), but
obviously the human is never shown a login screen - for him, nothing
at all happens.
Is it possible to redirect the “page” if the ajax requests is
redirected, so the login form is shown and the user is able to
proceed?
What would be a better solution, if that’s not possible…I am kinda
out of ideas.
Thanks for your help,
Rene