Skip to content

Use my own chosen patch

tsechingho edited this page Sep 17, 2012 · 1 revision

You hack some official chosen javascripts, but don't want to create another gem for this patch, and just want to put this patch to specific rails project. Do it as following steps.

  1. create a folder app/assets/javascripts/chosen, and put all your hacked coffee scripts / javascripts of chosen into it. ex:
app/assets/javacripts/chosen/hacked.chosen.jquery.coffee
  1. create a app/assets/javascripts/my-chosen-jquery.js to require all official scripts, except the one you hacked, and all your hacked scripts, ex:
//= require lib/abstract-chosen
//= require lib/select-parser
//# require chosen.jquery
//= require chosen/hacked.chosen.jquery
  1. instead of requiring chosen-jquery javascript provided by chosen-rails, require above javascript file in your app/assets/javascripts/application.js, ex:
//# require chosen-jquery
//= require my-chosen-jquery

That's all.

Clone this wiki locally