title: Javascript redirect_to in rails
body: <p>I'm developing a Facebook application in Rails.  Some (not all) of the pages require the user to be logged in; if not, they are redirected to a "login" page.  I can't use <code>redirect_to</code> for this, as the redirect needs to be done via Javascript (as it's redirecting the parent frame); furthermore, the redirection needs to know the address of the originally requested page (to come back to), so I can't just redirect to a dummy page that will do the redirection.</p>
  
  <p>I've tried using a layout together with <code>render</code> to achieve this, however the original view is still run (though not yielded); since the view requires variables that only exist when the user is logged in, this creates errors, crashing the script.</p>
  
  <p>Is it possible to render the layout but stop the view from executing?  Is there a better way to accomplish this?</p>