I figured it out...
tmp_dealerships = Dealership.search( make_name,:with => {:makes_id =>
make_id, :disabled => false,"@geodist" =>
last_miles_in_meters..miles_in_meters},:order => "offer_count
desc,time_to_offer asc,@geodist asc",:per_page =>
number_of_dealerships_to_add * 3, :page => 1,:geo =>
[ degrees_to_radians(zip_code.latitude),
degrees_to_radians(zip_code.longitude)]).compact
puts tmp_dealerships.class # Array
changes to this:
tmp_dealerships = Dealership.search( make_name,:with => {:makes_id =>
make_id, :disabled => false,"@geodist" =>
last_miles_in_meters..miles_in_meters},:order => "offer_count
desc,time_to_offer asc,@geodist asc",:per_page =>
number_of_dealerships_to_add * 3, :page => 1,:geo =>
[ degrees_to_radians(zip_code.latitude),
degrees_to_radians(zip_code.longitude)])
puts tmp_dealerships.class # ThinkingSphinx::Search
I was using compact at some point as I was getting empty
values...probably removing entries, but the indexes were still there.
I used compact to remove the entries. Now it seems to be turning the
thinking_sphinx container into an array. I think before it was a
ThinkingSphinx::Collection of something and it worked just fine.
Erik
On Feb 17, 1:38 pm, erik <[email protected]> wrote:
> I upgraded to Rails 2.3.8 and thinking_sphinx gem 1.3.11
>
> I was using Rails 2.2.2 and an old thinking_sphinx plugin.
>
> Most things are working fine, but when i try to use each_with_geodist
> I get this error:
> NoMethodError: undefined method `each_with_geodist' for #<Array:
> 0x10c6f9408>
>
> I saw this post about the resolution was to
> upgrade...http://groups.google.com/group/thinking-sphinx/tree/browse_frm/month/...
>
> The code where I'm having the issue
> tmp_dealerships = Dealership.search( make_name,
> :with => {:makes_id => make_id, :disabled =>
> false,"@geodist" => last_miles_in_meters..miles_in_meters},
> :order => "offer_count desc,time_to_offer
> asc,@geodist asc",
> :per_page => number_of_dealerships_to_add *
> 3, :page => 1,
> :geo =>
> [ degrees_to_radians(zip_code.latitude),
> degrees_to_radians(zip_code.longitude)]).compact
>
> ##create hash of the dealership stuff because a ts collection is
> not exactly an active record collection
> tmp_dealerships.each_with_geodist {|td,dist| ##line throwing the
> error
> .
> .
> .
> .}
>
> I am using mislav-will_paginate for other parts of my site. Could
> this be the issue?
>
> Thanks.
> Erik Landerholm
--
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/thinking-sphinx?hl=en.