我试图建立一个阻止用户的系统。
我试图选择用户没有阻止其所有者的战斗
到目前为止我尝试的是:
blocked_user_list = BlockedUser.where(:blocker_user_id => user.id).pluck(:user_id)
# If the user blocked any users
if (blocked_user_list.length > 0)
battles = Battle.all.join(:users).where("battles.user_id NOT IN (?)", blocked_user_list)
end
表格的结构
create_table "blocked_users", force: :cascade do |t|
t.integer "user_id" # The id of the blocked user
t.integer "blocker_user_id" # The id of the blocker user
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "battles", force: :cascade do |t|
t.integer "user_id"
t.string "title"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
我得到的错误是:Rails 4 TypeError:没有将Symbol隐式转换为String