I'm trying to integrate tokeninput in my little rails app following Ryan Bates Railscast nbr 258.
Therefore,
I added the tokeninput files in the vendors directory
I then changes my application.js file:
//
//= require jquery
//= require jquery_ujs
//= require jquery.tokeninput
//= require bootstrap
//= require chosen-jquery
//= require jquery_nested_form
//= require bootstrap-datetimepicker.min
//= require_tree .
Then I added this code in the file categories.js.coffee
jQuery ->
$('#company_category_list').tokenInput('/categories.json',
theme: 'facebook'
prePopulate: $('#company_category_list').data('load')
)
When I go to my form, the browser console says:
TypeError: $(...).tokenInput is not a function
[Break On This Error]
prePopulate: $('#company_category_list').data('load')
I've been looking for a couple of hours but I don't find the cause of this error. The jquery.tokeninput files seems to be loaded correctly by the asset pipeline.
Any help, suggestion welcome!
To summarize:
The issue I had was due to the fact that I once precompiled my assets and then decided to compile on the fly:
The precompilation created minified version of the assets in my public folder.
When I run my website, all the javascript files were then loaded twice: Once from the public folder and once from the normal flow.
I just deleted what I had in my public folder and it solved my issue.