#176 new

aaf 0.5.1 undefined method `includes_values' for :conditions:Symbol

Reported by stinger | September 21st, 2010 @ 02:39 PM

When I try to use find_with_ferret(query) I get this message only. I've digged the web and found that probably the new Active Record is causing this issue - the only hint I've got is from here: http://markgandolfo.com/2010/09/05/rails3-undefined-method-includes...

So, digging deep I've found that most of the internal find calls use the old ActiveRecord query model. Probably using :all on them causes this...

Please, help :)

Comments and changes to this ticket

  • Tony

    Tony October 9th, 2010 @ 07:07 AM

    I'm not sure if this breaks anything else but here is what I changed to make this work

    in acts_as_ferret-0.5.1/lib/acts_as_ferret.rb

    tmp_result = model_class.find(:all, find_options.merge(:conditions => conditions,

                                         :include    => filtered_include_options))

    I changed to
    tmp_result = model_class.where(options[:conditions]).includes(options[:include])

  • parallaxe

    parallaxe October 11th, 2010 @ 02:20 PM

    I had the same issue but the patch of Tony helped me to get a first simple query working (it's my first use of ferret). An quite irritating difference to Tonys patch is, that i had to use find_options instead of options.

  • Tony

    Tony October 11th, 2010 @ 05:54 PM

    oops. I guess I missed a line. here is what I have

      options = find_options.merge(:conditions => conditions,:include    => filtered_include_options)
      tmp_result = model_class.where(options[:conditions]).includes(options[:include])

    This is what I get for coding at 3AM.

  • stinger

    stinger October 12th, 2010 @ 11:13 AM

    OK, I can confirm that this fix worked for me too, but I've used the following syntax:

    tmp_result = model_class.where(conditions).includes(filtered_include_options)

    I think this is a bit shorter. There's no need to merge hashes because ActiveRecord 3.0 escapes the conditions and include options by default

  • Tony

    Tony October 27th, 2010 @ 01:13 PM

    • Assigned user set to “Jens”

    stinger, you still need to merge in the options that were passed into the method.

    Obviously this change breaks the plugin for rails 2 users.

    I suspect we need an ugly Rails::VERSION::STRING check

  • Tony

    Tony November 8th, 2010 @ 04:45 PM

    FYI. my changes for 176, 177 and 179 are here


    Add this to Gemfile if you want to use them

    gem 'acts_as_ferret', '= 0.5.2', :git => "git://github.com/primerano/acts_as_ferret.git

    unfortunately the AAF tests don't seem to work with Rails3 so I didn't submit a pull request as I don't want to break anything.

  • Silviu Rosu

    Silviu Rosu January 26th, 2011 @ 09:57 PM

    I have the same error. I receive this:
    undefined method includes_values' for :conditions:Symbol<br/> /Users/silviu/.rvm/gems/ruby-1.8.7-p302/gems/activerecord-3.0.3/lib/active_record/relation/spawn_methods.rb:11:insend'

    when I call Model.find(id)

    I use Rails 3.0.3 and Ruby 1.8.7
    The patch from above works in some way (in development mode). When I start the application in production mode does not work any more.
    I notices that if that in production.rb I change:
    config.cache_classes = false
    it works.

    So I think that the problem is related also with caching (Maybe rails cache some classes but not one that ferret needs)

    Hope this helps investigation.

  • Adam Doolette

    Adam Doolette November 10th, 2018 @ 06:08 AM

    A light house is built and constructed for the happiness of the people. The marks of the light and uk best have been ensured for the formation of the new opportunities for the followers of the light house.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Shared Ticket Bins

People watching this ticket