geocoder icon indicating copy to clipboard operation
geocoder copied to clipboard

<NoMethodError: undefined method `geocoded_by' for #<Class:0x00000003582f98>>

Open HimaChitalia opened this issue 9 years ago • 0 comments

Expected behavior

To get the Latitude and Longitude information

Actual behavior

Started POST "/api/v1/geolocation" for 127.0.0.1 at 2017-08-25 22:49:13 -0400
   (1.2ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC

NoMethodError (undefined method `geocoded_by' for #<Class:0x00000003582f98>):

app/models/location.rb:3:in `<class:Location>'
app/models/location.rb:1:in `<top (required)>'

Steps to reproduce

location.rb

class Location < ApplicationRecord

  geocoded_by :full_street_address
  after_validation :geocode, if: ->(obj){ obj.address.present? and obj.address_changed? } 

  private

    def full_street_address
      [address, city, state, zipcode].compact.join(", ")
    end
end

Environment info

  • Geocoder version: 1.2.1
  • Rails version: 5.1.3
  • Database (if applicable): PG

HimaChitalia avatar Aug 26 '17 02:08 HimaChitalia