Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7053231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:28:48+00:00 2026-05-28T03:28:48+00:00

I am trying to do what is described here: http://freelancing-god.github.com/ts/en/geosearching.html Except rather than having

  • 0

I am trying to do what is described here:
http://freelancing-god.github.com/ts/en/geosearching.html

Except rather than having latitude and longitude columns on my model, I want to do:

class Post
  has_one :location, :as => :locationable
end

class User
  has_one :location, :as => :locationable
end

class Location
  belongs_to :locationable, :polymorphic => true
end

so that User and Post can both have location records set by locationable_type and locationable_id… So I did the following in my Post model:

define_index do
  has locationable(:id), :as => :locationable_id
  has "RADIANS(locations.lat)", :as => :latitude, :type => :float
  has "RADIANS(locations.lng)", :as => :longitude, :type => :float
end

but I get an Unknown column in ‘field list’ error…

What am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:28:48+00:00Added an answer on May 28, 2026 at 3:28 am

    I figured it out.. This line:

    has locationable(:id), :as => :locationable_id
    

    Was supposed to be forcing a join… but it couldn’t because there is no such thing as locationable for a post record.. It has_one location.. So it needed to be:

    define_index do
      has location.locationable_id, :as => :locationable_id
      has "RADIANS(locations.lat)", :as => :latitude, :type => :float
      has "RADIANS(locations.lng)", :as => :longitude, :type => :float
    end
    

    and now it works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use the Qt new functions described here: http://opencv.willowgarage.com/documentation/cpp/qt_new_functions.html#cv-createbutton And I
I'm trying to get eclair sources as described here: http://source.android.com/source/downloading.html but getting into trouble
I'm trying to accomplish what is described here: http://sqldev.wordpress.com/2008/05/06/insert-into-temporary-table-from-stored-procedure/ The article says (with support
I am trying to send data to DotNetOpenAuth website as described here http://msdn.microsoft.com/en-us/library/debx8sh9.aspx Sender
I'm trying to register an atl service using ExeName.exe /service as described here: http://msdn.microsoft.com/en-us/library/74y2334x(VS.80).aspx
I'm trying to implement a website screen shot class as described here http://www.plentyofcode.com/2007/09/website-screenshot-capture-with-aspnet.html The
I'm trying to create a particular CSS button described here: http://www.2shared.com/file/5131551/412bd8a8/Sans_titre-1_copie.html Basically, it's a
So I'm having pretty much exactly the problem described here: http://code.google.com/p/android/issues/detail?id=6191 and until the
I'm trying to use Flurry analytics in an IPad app as described here: http://blog.kevfoo.com/index.php/2010/08/monotouch-flurry-analytics-bindings/
Im trying the jquery ui selecmenu, described here: http://wiki.jqueryui.com/w/page/12138056/Selectmenu I'm using verion 1.4.2 of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.