5

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.

2 Answers 2

7

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.

Sign up to request clarification or add additional context in comments.

2 Comments

it looks like that only works for rails 3.2.3 and I'm using rails 4.0.3
I have updated my answer. You should specify the Rails version on tags of original post.
1

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.

1 Comment

so just do <%= javascript_include_tag 'vendor/assets/javascripts/jquery.raty' %> at the top of the pages I want to use them for and I'll be good to go?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.