Alias :index => :list?

I have many controllers like this:

def index
list

render :action=>:list
end

def list
paginate …
end

Is there a class method that aliases index to list? Something like
‘alias :index => :list’ which causes :list to handle :index requests?
Ruby does have an ‘alias’ method, but it doesn’t seem to work like this.

Thanks,
Joe

On 10/1/06, Joe R. MUDCRAP-CE [email protected]
wrote:

paginate …
end

Is there a class method that aliases index to list? Something like
‘alias :index => :list’ which causes :list to handle :index requests?
Ruby does have an ‘alias’ method, but it doesn’t seem to work like this.

Thanks,
Joe

alias_method :list, :index should work as long as you do this:

def index
paginate…
render :action => ‘index’
end

This way your aliased #list action still renders the correct action.

However, I stopped using list actions since the need was being filled
by #index in all my cases.


Rick O.
http://weblog.techno-weenie.net
http://mephistoblog.com

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