Action alias

This is my current ActionController code.

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

def list
end

I wished this would work

alias index list

def list
end

But the problem is rails tries to render index.rhtml, instead of
list.rhtml when index action is invoked.

I want to be able write something like this

action_alias index list

which would add a method index to the class programatically.

please advise

Why don’t you make that action you are aliasing to, render the
template you want it to render.

render :template => “somedir/somefile”

On Nov 17, 3:29 am, Jigar G. [email protected]

dusty wrote:

Why don’t you make that action you are aliasing to, render the
template you want it to render.

render :template => “somedir/somefile”

On Nov 17, 3:29 am, Jigar G. [email protected]

As I have shown in the example, I have that as my current code, I was
looking to make it more concise.

Jigar G. escribió:

I want to be able write something like this

action_alias index list

which would add a method index to the class programatically.

please advise

Maybe you can play with routes.rb
Regards

–
Rafael Garcia Ortega

if you really just want one of those instead of two,
if you do it the RESTful way: get rid of the list action,
and stick with just the index action.

daniel

On Nov 17, 10:29 am, Jigar G. [email protected]