Ask A Question

Notifications

You’re not receiving notifications from this thread.

How do I implement a default_scope order when I'm using searchkick?

Jeramae Bohol asked in General

Before I implemented searchkick/elasticsearch on my rails app, the default_scope -> { order(created_at: :desc) } works. But after implementing searchkick/elasticsearch, it doesn't work anymore.

Reply

Since Searchkick is a whole separate process, it won't know about your Rails stuff. What I would say is if you write a helper method or class you can have it apply that scope to the options you pass in so that it always searches the same default scope.

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 86,796+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.