sameera207
sameera207

Reputation: 16629

Creating a Ruby gem with JavaScript files (Rails 3)

I'm planing to create a simple Ruby gem. The functionality is depending on some .js files. My plan is to install the gem via Github.

My questions are:

  1. should I write a generator to copy the js files?
  2. what is the best place to keep the js files (is it vendor/assets/javascripts?)
  3. how to write test cases for this (rspec2) ?

I'm using Rails > 3, Ruby 1.9.x and Ruby 2.x.

Upvotes: 3

Views: 140

Answers (1)

Amit Suroliya
Amit Suroliya

Reputation: 1535

We can easily use Javascripts library in ruby in following way -

1) We can put all js libararies in Vendor section and for their use we can define then application.js in following way

//= require datatable-pagination . .

2) Next if you want to use your own javascript then u put them into your assets folder and use then application.js in above way.

3) And if you want to make your own js library, then you can put your js libarary in lin folder.

Upvotes: 1

Related Questions