【发布时间】:2016-01-12 08:21:18
【问题描述】:
我正在尝试使用 Ransack 实现别名以缩短我的 URL 搜索查询。
根据文档: https://github.com/activerecord-hackery/ransack#ransack-aliases
class Post < ActiveRecord::Base
belongs_to :author
# Abbreviate :author_first_name_or_author_last_name to :author
ransack_alias :author, :author_first_name_or_author_last_name
end
但是当我在我的模型中使用它时,我得到了一个
undefined method `ransack_alias' for #<Class:0x007f9376f176e0>
【问题讨论】:
标签: ruby-on-rails ransack