I want to use the SQL clause "Use index('index_name')" to an ActiveRecord query, does anyone knows a good way to do it with Activerecord I wanted to avoid adding string directly to the query.
I use this in my models:
def self.use_index(index)
from("#{self.table_name} USE INDEX(#{index})")
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With