Closed steelheaddigital closed 1 year ago
In Rails 4.1. these are no longer deprecation warnings, but errors:
Tip.find_with_index('foo') NoMethodError: undefined method `with_scope' for Tip (call 'Tip.connection' to establish a connection):Class
Fix for this later in the week.
Thanks for the reports.
Tip to users: If you want to use the gem on Rails 4.1, and is getting undefined method `with_scope', try using the :ids_only option (see docs) and then use the ids you got on Model.where(id: ids)
I'm waiting for a fix, but sometimes you have a short deadline :)
Hi dugal, could you possibly include the patch of recotan (https://github.com/rekotan/acts_as_indexed/commit/923325c48f241c6739aa0f1befb3fbbe20e69ad3), it obviously fixes the deprecation in a simple way.
I believe my recent changes have replaced this code.
Deprecation warnings with Rails 4.0.8 and ActiveRecord 4.0.8 when using find_with_index.
This code:
my_search_results = Post.find_with_index('my search query')
will cause the following deprecation warnings:
DEPRECATION WARNING: ActiveRecord::Base#with_scope and #with_exclusive_scope are deprecated. Please use ActiveRecord::Relation#scoping instead. (You can use #merge to merge multiple scopes together.)
DEPRECATION WARNING: Calling #find(:all) is deprecated. Please call #all directly instead. You have also used finder options. These are also deprecated. Please build a scope instead of using finder options
DEPRECATION WARNING: Relation#all is deprecated. If you want to eager-load a relation, you can call #load (e.g.
Post.where(published: true).load
). If you want to get an array of records from a relation, you can call #to_a (e.g.Post.where(published: true).to_a
)