我将 ActiveAdmin 添加到我的应用程序中,更新了一些 gem,现在我得到了undefined method `link_to_function'
查看用户显示页面时。我有will_paginate
gem 和我添加了一个初始化程序,所以没有冲突。
雷.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
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)