Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 4 app - where to put custom jQuery plugins and how to include them

I'm trying to add Raty to my rails 4 app, but was wondering where I need to put it. I'm assuming the lib folder just needs to be put into this path?

vendor/assets/javascripts

And then to use the script I just do <%= javascript_include_tag 'vendor/assets/javascripts/jquery.raty' %> in my files? I want to be able to use it on multiple pages. Also, can I use the script in .erb files or only regular html? Completely new to this so any help is appreciated, thank you.

like image 221
parameter Avatar asked Mar 17 '14 19:03

parameter


1 Answers

You can download the plugin and save it in vendor/assets/javascripts. Then you include it on application.js:

//= require jquery.raty

This way the plugin is available throughout your application. The minified version of the plugin is about 8.3Kb.

like image 154
backpackerhh Avatar answered Oct 09 '22 06:10

backpackerhh