cannot use geokit or Geocoder inside property_web_builder engine

I was customizing the property_web_builder engine for getting nearby results using Geokit or Geocoder gem, but can't use any of it. getting undefined method 'gecoded_by' using 'Geocoder' gem and undefined method 'acts_as_mappable' for 'geokit-rails' gem.

Here is what I was doing - For geokit-rails

module Pwb
  class Prop < ApplicationRecord
    translates :title, :description
    globalize_accessors locales: I18n.available_locales
    attribute :title
    attribute :description
    acts_as_mappable :default_units => :miles,
    :lat_column_name => :latitude,
    :lng_column_name => :longitude

For Geocoder

module Pwb
  class Prop < ApplicationRecord
    translates :title, :description
    globalize_accessors locales: I18n.available_locales
    attribute :title
    attribute :description
    geocoded_by :complete_address
    after_validation :geocode

When I try finding the results in rails console after adding the engine on project as described in readme. I get these results.

p = Pwb::Prop.first NoMethodError: undefined method `acts_as_mappable' for #Class:0x007f04ecda5118 from (irb):1

similiar for geocoder

p = Pwb::Prop.first NoMethodError: undefined method `geocoded_by' for #Class:0x007f04ecda5118 from (irb):1

ruby-on-railsrails-enginesrails-geocodergeokit

Answers

answered 6 months ago Prateek Darmwal #1

Added gem to application gemfile instead of pwb engine's gemfile and it worked.

comments powered by Disqus