如何使用https://github.com/ankane/searchkick搜索Users
和Skills
并返回具有搜索技能的用户。最相关的结果应反映skills
User
中有多少class User < ApplicationRecord
searchkick
has_many :user_skills
has_many :skills, through: :user_skills
end
class Skill < ApplicationRecord
searchkick
has_many :user_skills
has_many :users, through: :user_skills
end
class UserSkill < ApplicationRecord
searchkick
belongs_to :user
belongs_to :skill
end
。
我的模特看起来像这样:
@search = User.search "*", where: {
skill_ids: {all: [1, 3]}
}
我已尝试过以下操作,但未返回任何结果:
var builder = new AlertDialog.Builder (this);
...
...
...
var dialog = builder.Show ();
int textColorId = Resources.GetIdentifier ("alertTitle", "id", "android");
TextView textColor = dialog.FindViewById<TextView> (textColorId);
textColor?.SetTextColor (Color.DarkRed);
答案 0 :(得分:0)
仅仅因为没有返回结果,并不意味着它不起作用。
解释这应该如何在您的问题中返回结果。
@search = User.search "*", where: { skill_ids: [1, 3] }