mrkamel / search_cop

Search engine like fulltext query support for ActiveRecord
MIT License
825 stars 39 forks source link

DEPRECATION WARNING #54

Closed Bilal-Abbas closed 4 years ago

Bilal-Abbas commented 4 years ago

DEPRECATION WARNING: #search is deprecated and will be removed in 2.3, please use #ransack instead (called from pry at (pry):21)

mrkamel commented 4 years ago

not very detailed, unfortunately, but i think this is due to how you named your search scope

Bilal-Abbas commented 4 years ago

I have solved my problem. This problem was due to not using the search correctly in many to many associations using through I have fixed it. In my organization modal, I have

has_many :subscribers, through: :organization_subscriptions, source: :user

and my organization_subscriptions modal has

belongs_to :user belongs_to :organization

I simply add the following and it worked in the console as well as in the development

search_scope :search do attributes user: ["user.user_id"] end