Currently working on a Facebook application using Rails. There are certain pages that require users to be logged in, otherwise they will be directed to a "login" page. I am unable to use redirect_to
for this purpose as the redirection must be done through Javascript to redirect the parent frame. Additionally, the redirection needs to know the original page requested in order to navigate back, so simply redirecting to a dummy page is not an option.
I attempted to implement a layout with render
to address this issue but encountered problems when the original view was still executed (albeit without being yielded). Since the view relies on variables only available when the user is logged in, errors occurred, leading to script crashes.
Is there a way to render the layout without executing the view? Are there alternative approaches to achieve this goal?