I followed the railscast tutorial , but I found I can not load the "saved tokens".
I think the problem is that when click 'edit' link (created by scaffold),
it didn't trigger the preload function, how do you fix the problems in Rails 4
View page
.form-inputs
= f.input :name
= f.input :content
= f.text_field :user_tokens, data: {load: @article.users}
My coffeescript
$(document).ready ->
$('#article_user_tokens').tokenInput '/users.json',
theme: 'facebook',
prePopulate: $('#article_user_tokens').data('load')
Require the css and js file
*= require token-input-facebook
//= require jquery.tokeninput
I fix the bug by this solution, use the ready page:load
But I can not understand, why it works
$(document).on "ready page:load", ->
$('#article_user_tokens').tokenInput '/users.json',
theme: 'facebook',
prePopulate: $('#article_user_tokens').data('load')