Awesome video. I am wondering how would I take the show page and link it to a different js file. The index.js is global correct? What would be the best way to setup a show view with just the map for a specific item?
I am having a hard time understanding how page specific js would be bad? What if I would like a different kind of map for a different page or js that would be used only on one specific page? Is there an easy way to implement it when deemed necessary?
Chris in regards to the show page mentioned above what would the syntax look like to just display the one item on the show page? Not too familiar with arrays to know how to set that up.
Does anybody know some good setup defaults using Gmaps with webpacker & Rails 6?
Super late reply, but I figured out how to properly import this while using Webpack and Rails.
application.js file, instead of simply having
import 'gmaps';, do the following:
import 'gmaps'; import GMaps from 'gmaps'; window.GMaps = GMaps;
This also applies for those of you (like me) who keep getting "function is not defined" errors.
Join 29,237+ developers who get early access to new screencasts, articles, guides, updates, and more.