One common template for different actions ? possible or not

Hi all,

Hey I want to know that, is it possible to have commont templates for
different methods(actions) in the controller?
Please reply!


Regards,
Anil W.
http://anilw.info
Don’t live to geek; geek to live.

If you’re thinking of something like a layout for a controller, no,
that’s not available. However, the simple sidebar plugin (http://
www.agilewebdevelopment.com/plugins/simple_sidebar) might fit your
needs.


Benjamin C.
http://www.bencurtis.com/
http://www.tesly.com/ – Collaborative test case management
http://www.agilewebdevelopment.com/ – Resources for the Rails community

yes, the standard scaffold shows one way. For example, the standard
index action is

def index
list
render :action => ‘list’
end

the render bit says to display with the template as for list. In general

render :action => thing

will use the templates for thing (using standard naming conventions
– ie, the template has the same name as the action + .rhtml)

More elaborate overriding of templates is possible, if you read the
relevant documentation.



John B.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs