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}"
else
link_to_original( name, options,
html_options,*parameters_for_method_reference )
end
end
end