views:

38

answers:

2

Okay, I have a few different of ideas of how I would achieve this, but thought I would ask here in case someone has a better solution.

I have a SessionsController that has a login view and a widget_login view. I was wondering how to go about determining which view to render in the new action of SessionsController.

Right now, everything uses the standard login view. I was hoping to be able to render the widget_login view instead if the request is coming from my widget (reviewscontroller) which has a "Sign in" link on it. I don't want to use the referrer to determine this if possible.

Thanks

A: 

at the end of the action code:

render :layout => 'my_layout'

if there was already a render call, modify it adding the :layout parameter.

aularon
+1  A: 

Not sure if this is feasible without seeing your code, but how about something like this:

respond_to do |format|
    format.html { render(:action => 'new') }
    format.widget { render(:action => 'widget_login') }
end

Then in your widget link to new.widget.

captaintokyo
Ok, I knew it had to be something simple. I'm an intern and have been learning a ton and my brain has to catch up sometimes. This should most definitely be feasible with my code. It's kind of funny to me I didn't think of this because I used code exactly like this to render the iframe for the widget.Thanks!
John Dyer