Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

« Newer Snippets
Older Snippets »
2 total  XML / RSS feed 

rendering layout from different controller

If an action in one controller leads to a deadly similar template as in another controller, you can just borrow that controller's action template by calling render at the end of your action.
render :template => ''

Say your in tags controller in the show action. You can use the template found in /apps/views/lists/index.rhtml
def show
  [boring action logic]
  render :template => 'lists/index'

default layout for a controller

// description of your code here
In your controller add the name of the .rhtml file in /apps/layouts/ that you want to use, without the suffix (.rhtml).
When rails spits out your view, it will use this given layout as the container for your rendered action.
layout ""
« Newer Snippets
Older Snippets »
2 total  XML / RSS feed