Paul Chin wrote:> Hi all I''m trying user alias_method to overload the link_to
method, It
> works the first time, but when I reload the page, it will have an error
> "stack level too deep".
>
> I''m using rails 0.14.3 ruby 1.8.2 Webrick in winxp, I suspect it
is a bug.
>
> this is my helper''s code
>
> module UsersHelper
> include ActionView::Helpers::UrlHelper
>
> alias_method :link_to_original, :link_to
>
> def link_to(name, options = {}, html_options >
nil,*parameters_for_method_reference)
> if permission?
> link_to_original( name,
> options,html_options,*parameters_for_method_reference )
> end
> end
>
>
> end
Does this happen in production mode or just in development? In development
code is reloaded on every request. On the second request you will loose
link_to_original, both methodnames will cover your link_to version ...
--
Company - http://primalgrasp.com
Thoughts - http://deezsombor.blogspot.com