NoMethodError未定义的方法`link_to_function’

我将ActiveAdmin添加到我的应用程序中,更新了一些gem,现在我在查看用户显示页面时得到了一个undefined method `link_to_function' 。 我有will_paginate gem,我添加了一个初始化程序,所以没有冲突。

kaminari.rb:

 Kaminari.configure do |config| config.page_method_name = :per_page_kaminari end 

该错误指向/app/helpers/will_paginate_helper.rb上的行:

  @template.link_to_function(text.to_s.html_safe, ajax_call, attributes) 

添加帮助方法,它将解决您的问题。

link_to_function_helper.rb:

 module LinkToFunctionHelper def link_to_function(name, *args, &block) html_options = args.extract_options!.symbolize_keys function = block_given? ? update_page(&block) : args[0] || '' onclick = "#{"#{html_options[:onclick]}; " if html_options[:onclick]}#{function}; return false;" href = html_options[:href] || '#' content_tag(:a, name, html_options.merge(:href => href, :onclick => onclick)) end end