Giter Site home page Giter Site logo

eload-select's People

Contributors

blythedunham avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

vmlellis

eload-select's Issues

Breaks with geokit

Geokit allows you to make a model mappable through an associated model. So if user is mappable and has lat, lng columns then another model Post can be mappable through user without having lat, lng columns.

So a typical search like User.find(:all, :origin => 'new york, ca', :within => 10) works just fine. but
Post.find(:all, :origin => 'new york, ca', :within => 10) breaks with a long trace.

Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '))+, lng))+, posts.id AS t0_r0, users.id AS t1_r0 FROM posts' at line 4: SELECT _, (ACOS(least(1, COS(0.65877452616526)_COS(-2.13694622955682)_COS(RADIANS(users.lat))_COS(RADIANS(users.lng))+
COS(0.65877452616526)_SIN(-2.13694622955682)_COS(RADIANS(users.lat))_SIN(RADIANS(users.lng))+
SIN(0.65877452616526)_SIN(RADIANS(users.lat))))_3963.19)
AS distance, lng))+, lng))+, posts.id AS t0_r0, users.id AS t1_r0 FROM posts LEFT OUTER JOIN users ON users.id = posts.user_id WHERE (((users.lat>37.6004301471464 AND users.lat<37.8895698528536 AND users.lng>-122.620827631197 AND users.lng<-122.255172368803)) AND (
(ACOS(least(1,COS(0.65877452616526)_COS(-2.13694622955682)_COS(RADIANS(users.lat))_COS(RADIANS(users.lng))+
COS(0.65877452616526)_SIN(-2.13694622955682)_COS(RADIANS(users.lat))_SIN(RADIANS(users.lng))+
SIN(0.65877452616526)_SIN(RADIANS(users.lat))))_3963.19)
<= 10))
ActiveRecord::StatementInvalid: Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '))+, lng))+, posts.id AS t0_r0, users.id AS t1_r0 FROM posts' at line 4: SELECT *, (ACOS(least(1, COS(0.65877452616526)_COS(-2.13694622955682)_COS(RADIANS(users.lat))_COS(RADIANS(users.lng))+
COS(0.65877452616526)_SIN(-2.13694622955682)_COS(RADIANS(users.lat))_SIN(RADIANS(users.lng))+
SIN(0.65877452616526)_SIN(RADIANS(users.lat))))_3963.19)
AS distance, lng))+, lng))+, posts.id AS t0_r0, users.id AS t1_r0 FROM posts LEFT OUTER JOIN users ON users.id = posts.user_id WHERE (((users.lat>37.6004301471464 AND users.lat<37.8895698528536 AND users.lng>-122.620827631197 AND users.lng<-122.255172368803)) AND (
(ACOS(least(1,COS(0.65877452616526)_COS(-2.13694622955682)_COS(RADIANS(users.lat))_COS(RADIANS(users.lng))+
COS(0.65877452616526)_SIN(-2.13694622955682)_COS(RADIANS(users.lat))_SIN(RADIANS(users.lng))+
SIN(0.65877452616526)_SIN(RADIANS(users.lat))))*3963.19)
<= 10))
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract_adapter.rb:219:in log' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:323:inexecute_without_analyzer'
from /usr/lib/ruby/gems/1.8/gems/rails-footnotes-3.6.7/lib/rails-footnotes/notes/queries_note.rb:152:in execute' from /usr/lib/ruby/1.8/benchmark.rb:308:inrealtime'
from /usr/lib/ruby/gems/1.8/gems/rails-footnotes-3.6.7/lib/rails-footnotes/notes/queries_note.rb:152:in execute' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:608:inselect'
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in select_all_without_query_cache' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/query_cache.rb:62:inselect_all'
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations.rb:1617:in select_all_rows' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations.rb:1395:infind_with_associations'
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations.rb:1393:in catch' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations.rb:1393:infind_with_associations'
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:1546:in find_every' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:615:infind'
from /home//Apps/nap_on_it/vendor/plugins/geokit-rails/lib/geokit-rails/acts_as_mappable.rb:153:in find' from /home//Apps/nap_on_it/config/initializers/geokit_for_named_scope.rb:5:infind'
from (irb):11>>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.