Forum: Ruby on Rails a better way to alias methods

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
51f10739fd903d3b57561a15e4598954?d=identicon&s=25 M Daggett (Guest)
on 2006-03-12 19:28
(Received via mailing list)
Hi is there a better way to accomplish this task?

class PortfolioController < ProjectController
    layout 'portfolio'



    def boing
        redirect_to :action=>:index
    end




    alias_method :new     , :boing
    alias_method :destroy , :boing
    alias_method :edit    , :boing
    alias_method :update  , :boing
end

My portfolio controller implements view only control of the project
controller therefore I want to prevent the user from poking around for
sensitive methods inside the project controller.
This is my current implementation, but it doesn't feel very DRY.
Thanks,
Mark
119af50160cabfe1fb6f2f05f5018c64?d=identicon&s=25 James Ludlow (Guest)
on 2006-03-12 19:38
(Received via mailing list)
On 3/12/06, M Daggett <heavysixer@gmail.com> wrote:
>     alias_method :edit    , :boing
>     alias_method :update  , :boing
> end
>
> My portfolio controller implements view only control of the project
> controller therefore I want to prevent the user from poking around for
> sensitive methods inside the project controller.
> This is my current implementation, but it doesn't feel very DRY.
> Thanks,
> Mark

If that's the only method you want to expose, you could define a route
that always calls that action when that controller is accessed.
This topic is locked and can not be replied to.