Render :action for moved templates

I have two actions, that I want to use the same template. However, the
template is stored in a non-stardard location (a subdirectory under
views/). My original code looked like:

def edit_member

render :template => “path/to/template/edit_member”

def add_member

render :action => :edit_member

The intent here is that add_member is a special case of edit_member.
Edit_member points to its template (an .rjs file), and add_member
points to edit_member to pick up the same template

Unfortunately, add_member does not find the template. Apparently it
tries to find where the default template would be stored for
edit_member (app/views//edit_member.???)

Obviously, I could repeate the render :template line in add_member,
but would prefer to only list the path/template name once. Is there
some way to do this? Or some way to have the templates for each
action listed external to the action definition?

The documentation doesn’t describe what “render :action” does very
well. Just “renders the template for the action”, which is something
of a circular definition.


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