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 actio开发者_如何学JAVAn 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
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
.
at the end of the action code:
render :layout => 'my_layout'
if there was already a render
call, modify it adding the :layout
parameter.
精彩评论