Efe
Efe

Reputation: 954

How do I add jQuery plugins on my rails app

I will use the GMAP3 Plugin for JQuery in my rails app.

I already put the javascript file in app/assets/javascripts/gmap3/gmap3.min.js.

I will use this jQuery plugin only on the welcome page. What files do I need to modify (and how) in order to make use the plugin?

Upvotes: 5

Views: 6255

Answers (1)

nicosantangelo
nicosantangelo

Reputation: 13726

You should put the file ( for a Rails 3 project ) in vendor/assets/javascripts/gmap3.min.js and then you should add it in two ways:

<%= javascript_include_tag 'gmap3.min' %>

or in some added file like

//In (for example) application.js

//= require gmap3.min

If you added the file correctly, that is, in a page that you are seeing (you can check this in your browser console, usually in Resources or Network ), you can use it.

Some links for you to see:

Upvotes: 4

Related Questions