Question

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.

Was it helpful?

Solution 2

If you'll need them on multiple pages, sometimes its easiest just to dump them in app/assets/javascripts. This will include the script on every page without the need to make an explicit call. If you want, you could put them in public/js and reference them on whatever pages require the scripts.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top