title: "undefined method `/' for "":String:" Error when implementing geokit
body: <p>I'm trying to use geokit to find all the entities next to a given set of coordinates, I've been trying for quite a few hours now and can't seem to find what the issue is.</p>
  
  <p>Initially thought it would have something to do with the Latitude and Longitude columns being String, so just ran a migration to convert them into Decimal following <a href="https://stackoverflow.com/questions/11041818/rails-3-float-or-decimal-for-gps-coordinates">this</a> guideline, yet no luck as I am still getting the following exception.</p>
  
  <p>Here is my model:</p>
  
  <pre><code>class Video &lt; ActiveRecord::Base
    include Rails.application.routes.url_helpers
    include ActiveModel::Dirty
  
    belongs_to :user
    belongs_to :camera
    belongs_to :lens
    belongs_to :airframe
    belongs_to :codec
    belongs_to :video_format
    belongs_to :updated_by, :class_name =&gt; "User"
  
    attr_accessible :duration, :location, :user_id, :camera_id, :lens_id, :video_format_id, 
                    :codec_id, :title, :description, :source_filename, 
                    :latitude, :longitude, :airframe_id, :resolution, :framerate, :bitrate,
                    :recording_datetime, :permissions, :source_video, :status, :terms_and_conditions, 
                    :updated_by_id, :video_tags_attributes, :staff_pick, :gallery_id
  
    acts_as_mappable :lat_column_name =&gt; :latitude,
                     :lng_column_name =&gt; :longitude
  
  end
  </code></pre>
  
  <p>And my controller's action:</p>
  
  <pre><code>def index_by_location
      origin = Geokit::LatLng.new(32.91663,-96.982841)
      #origin = Video.geo_scope(:origin =&gt; [37.792,-122.393]) does not work
      videos = Video.in_range(2..5, :origin =&gt; origin)
      render :json =&gt; videos
    end
  </code></pre>
  
  <p>And this is the error I'm getting:</p>
  
  <pre><code> NoMethodError: undefined method `/' for "":String: SELECT "videos".* FROM "videos"  WHERE ((
            (CASE WHEN videos.latitude IS NULL OR videos.longitude IS NULL THEN NULL ELSE
            (ACOS(least(1,COS(0.5745035721607411)*COS(-1.6926698933881499)*COS(RADIANS(videos.latitude))*COS(RADIANS(videos.longitude))+
            COS(0.5745035721607411)*SIN(-1.6926698933881499)*COS(RADIANS(videos.latitude))*SIN(RADIANS(videos.longitude))+
            SIN(0.5745035721607411)*SIN(RADIANS(videos.latitude))))*3963.1899999999996)
            END)
            &gt;= 2 AND 
            (CASE WHEN videos.latitude IS NULL OR videos.longitude IS NULL THEN NULL ELSE
            (ACOS(least(1,COS(0.5745035721607411)*COS(-1.6926698933881499)*COS(RADIANS(videos.latitude))*COS(RADIANS(videos.longitude))+
            COS(0.5745035721607411)*SIN(-1.6926698933881499)*COS(RADIANS(videos.latitude))*SIN(RADIANS(videos.longitude))+
            SIN(0.5745035721607411)*SIN(RADIANS(videos.latitude))))*3963.1899999999996)
            END)
            &lt;= 5))
  </code></pre>
  
  <p>Could anyone please help?
  Thanks!</p>