1
class UserGroup
has_many :users
end
class User
has_many :posts
end
class Post
end
我們可以使用ransack搜索post_pos位置中的user_group字段嗎?使用Ransack搜索字段2級以上的關聯
謝謝!
class UserGroup
has_many :users
end
class User
has_many :posts
end
class Post
end
我們可以使用ransack搜索post_pos位置中的user_group字段嗎?使用Ransack搜索字段2級以上的關聯
謝謝!
,你可以嘗試像Post.ransack(user_user_group_type_eq: 'admin')
這裏我假設用戶組類將有一列type
並比較其重視admin