datatables with rails issue

2019-08-10 02:15发布

问题:

I have included this in my rails:

gem 'jquery-datatables-rails', github: 'rweng/jquery-datatables-rails'

but when I start the server I'm getting this error :

←[31mYou passed :github as an option for gem 'jquery-datatables-rails', but it is invalid.←[0m

I guess its because I'm running it locally.BTW,what will be my path if I'm running it locally?

1 more thing I followed this cast:

http://railscasts.com/episodes/340-datatables?view=asciicast

I have also tried simply this:

gem 'jquery-datatables-rails'

But after bundle install the css and js files are not downloaded and it is giving me file not found error.

回答1:

Check the cast:

The github option is new in Bundler 1.1. If you don’t have this you’ll need to pass in the full git path instead.

So try to use

gem 'jquery-datatables-rails', git: 'https://github.com/rweng/jquery-datatables-rails.git'


回答2:

Difficult to say why your table is hidden without the view and associated javascript code.

Check if you call the dataTable() function on the correct table DOM element. Also check for any fancy parameters in the call.

If that checks out, post the code for more help.