On 10/1/06, Joe Ruby MUDCRAP-CE
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:>
> 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
>
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 Olson
http://weblog.techno-weenie.net
http://mephistoblog.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---