Question

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

Was it helpful?

Solution

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.

OTHER TIPS

at the end of the action code:

render :layout => 'my_layout'

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top