Ruby on rails 搜掠搜索有很多途径
我有一个侧面模型:Ruby on rails 搜掠搜索有很多途径,ruby-on-rails,ruby,ransack,Ruby On Rails,Ruby,Ransack,我有一个侧面模型: has_one :job_preference, inverse_of: :profile, dependent: :destroy accepts_nested_attributes_for :job_preference, reject_if: :all_blank, allow_destroy: true 工作偏好模型: belongs_to :profile has_many :job_preferences_wanted_locations has_many :w
has_one :job_preference, inverse_of: :profile, dependent: :destroy
accepts_nested_attributes_for :job_preference, reject_if: :all_blank, allow_destroy: true
工作偏好模型:
belongs_to :profile
has_many :job_preferences_wanted_locations
has_many :wanted_locations, through: :job_preferences_wanted_locations, dependent: :destroy
职位偏好招聘地点模型:
class JobPreferencesWantedLocation < ApplicationRecord
belongs_to :job_preference
belongs_to :wanted_location
accepts_nested_attributes_for :wanted_location
end
我已阅读了搜查文件,并尝试了以下变化:
job_preference_wanted_location_name_cont
但这似乎不起作用。试试看
job_preferences_job_preferences_wanted_locations_wanted_location_name_cont
从配置文件到关联(作业首选项-所需位置),再到所需位置本身和名称属性
问题是,如果我不记得不好,ransack不会通过关联直接工作。你的问题是什么?我试图在配置文件索引中使用ransack gem来查询想要的位置。
job_preference_wanted_location_name_cont
job_preferences_job_preferences_wanted_locations_wanted_location_name_cont