Reputation: 3337
I'm trying to integrate the select2 gem into my app to make my selects use jquery and look better. I've installed the gem and added the appropriate lines to my assets, but I'm not sure how to call it on a select.
Here's an example of my select without it.
Can someone point me in the right direction on how to call select2 on this to get it working?
Upvotes: 4
Views: 2928
Reputation: 4565
The select2-rails gem only gives you an easy way to include the Select2 assets, but it does not include any rails helper to call it.
In other words, you have to call it on your own from your javascript.
For instance ,in application.js:
$(document).ready(function(){
$('select').select2();
});
This would call select2 over every select in your app.
Hope it helps.
Upvotes: 4