Forum: Ruby on Rails undefined method `link_to'

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.
paulchin (Guest)
on 2005-11-29 14:35
(Received via mailing list)
Hi, all I'm trying call link_to from another helper
but got this error:

undefined method `link_to' for module `UserHelper'


how can I get access to helper from another helper?  this is my
users_helper.rb:

module UsersHelper

  alias ink_to_original link_to
  alias link_to link_to_permission


def link_to_permission(name, options = {}, html_options = nil,
*parameters_for_method_reference)
  if @permission
    if html_options
          html_options = html_options.stringify_keys
          convert_options_to_javascript!(html_options)
          tag_options = tag_options(html_options)
        else
          tag_options = nil
        end
        url = html_escape(options.is_a?(String) ? options :
url_for(options,
*parameters_for_method_reference))
        "<a href=\"#{url}\"#{tag_options}>#{name||url}</a>"
else
	link_to_original( name, options,
html_options,*parameters_for_method_reference )
end

end

end
This topic is locked and can not be replied to.