Presently my jquery token input is working perfectly fine.
Am not able to create token, which is not in the list
I have seen here, that this functionality is implemented. But there is no documentation on how we i can use this.
Can any one help me with documentation or demo
js_js.js
$(document).ready(function () {
$("#job_skills").tokenInput("/jobs/search_job_skills", {
theme: "facebook",
preventDuplicates: true,
hintText: 'Add skills need for job',
searchingText: 'searching skills...',
allowCreation: true,
creationText: 'Add new element'
});
});
cons_controller.rb
def search_job_skills
search_for_json(Skill)
end
def search_for_json(model_search)
@hash = []
@search_res = model_search.where(['name LIKE ?', "#{params[:term]}%"])
@search_res.each do |tag|
@hash << { id: tag.id,
name: tag.name}
end
render json: @hash
end