Undefined method error

Hi,
I’m running the trunk version with drb server. In my ferret_server.log I
get a lot of messages like this:

#method_missing(:add, [“User”, {:first_name=>“blah”, :comments=>nil,
:company=>“blah”, :phone_day=>""}])

Over and over again.

But more importantly, since yesterday doing a search has caused an
exception:

A NoMethodError occurred in partners#user_search:

undefined method each' for :sales_region:Symbol [RAILS_ROOT]/vendor/plugins/acts_as_ferret/lib/class_methods.rb:246:inretrieve_records’

Any idea what these could have been caused by?

Thanks,
Chris.

On Fri, Sep 28, 2007 at 12:38:15PM +0200, Chris W. wrote:

Hi,
I’m running the trunk version with drb server. In my ferret_server.log I
get a lot of messages like this:

#method_missing(:add, [“User”, {:first_name=>“blah”, :comments=>nil,
:company=>“blah”, :phone_day=>“”}])

Over and over again.

with aaf trunk you can raise the log level in ferret_server.yml so this
debug message doesn’t appear any more:

production:
log_level: warn

But more importantly, since yesterday doing a search has caused an
exception:

since yesterday? What did you change?

A NoMethodError occurred in partners#user_search:

undefined method each' for :sales_region:Symbol [RAILS_ROOT]/vendor/plugins/acts_as_ferret/lib/class_methods.rb:246:in retrieve_records’

Any idea what these could have been caused by?

not yet - I can’t seem to find the line the error refers too - what
exact
revision are you on? Or could you try that with the latest trunk (rev.
247).

How do you use that symbol in your code?

Cheers,
Jens


Jens Krämer
http://www.jkraemer.net/ - Blog
http://www.omdb.org/ - The new free film database

Thanks for the quick response and the logging tip.

But more importantly, since yesterday doing a search has caused an
exception:

since yesterday? What did you change?
Having looked at this again, this problem was introduced when I upgraded
the version to the trunk and switched to the drb server.

A NoMethodError occurred in partners#user_search:

undefined method each' for :sales_region:Symbol [RAILS_ROOT]/vendor/plugins/acts_as_ferret/lib/class_methods.rb:246:inretrieve_records’

Any idea what these could have been caused by?

not yet - I can’t seem to find the line the error refers too - what
exact
revision are you on? Or could you try that with the latest trunk (rev.
247).

How do you use that symbol in your code?

I just used the trunk, how can I find out which revision it was now?

The error is caused by the following include:
@results = User.find_by_contents(@query, {
:limit=>5000},:conditions=>“sales_regions.firm_id in
(#{firm_id_string})”,:include => :sales_region)

The code from aaf is here:
def retrieve_records(id_arrays, find_options = {})
result = []
# get objects for each model
id_arrays.each do |model, id_array|
next if id_array.empty?
begin
model = model.constantize
rescue
raise “Please use ‘:store_class_name => true’ if you want to
use multi_search.\n#{$!}”
end

    # check for include association that might only exist on some 

models in case of multi_search
filtered_include_options = []
if include_options = find_options[:include]
include_options.each do |include_option|
filtered_include_options << include_option if
model.reflections.has_key?(include_option.is_a?(Hash) ?
include_option.keys[0].to_sym : include_option.to_sym)
end
end

It’s the include_options.each do |include_option| causing the problem.

Thanks for your quick responses by the way, they are amazing.

Chris.

Hi Chris,

your problem seems to be a bug which has been fixed some time ago:
http://projects.jkraemer.net/acts_as_ferret/ticket/160
here’s the fix:
http://projects.jkraemer.net/acts_as_ferret/changeset/225

On Mon, Oct 01, 2007 at 04:01:43PM +0200, Chris W. wrote:

Thanks for the quick response and the logging tip.

But more importantly, since yesterday doing a search has caused an
exception:

since yesterday? What did you change?
Having looked at this again, this problem was introduced when I upgraded
the version to the trunk and switched to the drb server.

given the fact that this bug is fixed for more than a month now, I
suspect you still have an old version of the plugin somewhere…

Cheers,
Jens


Jens Krämer
webit! Gesellschaft für neue Medien mbH
Schnorrstraße 76 | 01069 Dresden
Telefon +49 351 46766-0 | Telefax +49 351 46766-66
[email protected] | www.webit.de

Amtsgericht Dresden | HRB 15422
GF Sven Haubold, Hagen Malessa

Upgrading fixed it. Thanks again.

Chris.