Condition for filtering records rails

ساخت وبلاگ
چکیده : I have user model and the user can associated with multiple tags(has and belongs to many association... با عنوان : Condition for filtering records rails بخوانید :

I have user model and the user can associated with multiple tags(has and belongs to many association)

In user model

has_and_belongs_to_many :tags

My current requirement is to filter the people based on the applied tags and non applied tags.

scope :tags_equals, -> (params) { joins(:tags).where('tags.tags ILIKE (?)', "#{params['value']}") }

But I could not do same thing for tag_not_contain filter(like below) as the people have many rows based on the tags applied.

    scope :tag_not_contain, -> (params) { joins(:tags).where('tags.tags not 
ILIKE (?)', "#{params['value']}") }

How could get the results in this case?

back soft...
ما را در سایت back soft دنبال می کنید

نویسنده : استخدام کار بازدید : 4 تاريخ : چهارشنبه 28 آذر 1397 ساعت: 8:36