Greetings all, I am trying out the new location fi...
# avo-2
w
Greetings all, I am trying out the new location field type and I think I'm missing some important step to get it to work as expected. Here are the steps I have taken: 1. Update avo to release 2.30.0 2. Add a new field to my resource class:
field :coordinates, as: :location, stored_as: [:latitude, :longitude]
(I already had latitude and longitude attributes on the model) 3. Add
def coordinates
and
def coordinates=()
methods to my model class. 4. Add the
mapkick
gem to my rails application. When I visit the show page for one of the so-modified resources, I expect to see a map on the page. Instead, I see the following error:
Copy code
undefined method `js_map' for #<Avo::Fields::LocationField::ShowComponent:0x00000001173d99c0 @compact=false, @field=#<Avo::Fields::LocationField:0x00000001302b5288 @show_on_index=false, @show_on_show=true, @show_on_new=true, @show_on_edit=true, @id=:coordinates, @name=nil, @translation_key=nil, @block=nil,
I took most of my inspiration from looking at the changes made to the dummy app in the commit, so I'm not sure what else I need to do for the
js_map
method from the gem to be available within avo.
l
yeah. I'm seeing the same thing on the demo app. not sure why. looking into it
I found it. you must add
mapkick-rb
in your
Gemfile
.
mapkick
is a different gem.
I changed it in the docs too
i
Huh. I wasn't aware of there being two. Tyty
l
yeah, it took me a while to figure it out too
w
ack, I can't believe I missed that!
I updated my Gemfile to include the
mapkick-rb
gem, and I was able to view the map on a resource show page. 💯
l
yeah. honest mistake. it took me a while to figur it out. I had
mapkick
in my gemfile too 😛