我有以下型号
class Position < ActiveRecord::Base
belongs_to :position_name
delegate :name, to: :position_name
而这个搜索表格
= search_form_for @search, url: '#', method: 'GET', html: {id: nil, class: "term_search_form"} do |f|
= f.text_field :name_cont, class: 'search-query', id: nil, placeholder: t('search')
我仍然收到此错误消息:
undefined method `name_cont' for #<Ransack::Search:0x007f97187c5b80>
我认为这是因为委托方法名称。
如何在委托方法上使用 ransack?