#= require jquery #= require jquery_ujs $(document).ready -> if typeof window.CKEDITOR is "undefined" window.CKEDITOR_BASEPATH = '/ckeditor/' $.getScript "/ckeditor/ckeditor.js", -> $( 'textarea.markup, textarea.markup-ckeditor' ).each -> textarea = $(@) id = textarea.attr('id') config = {} console.log($.extend(config, CKEDITOR.config)) config.width = textarea.outerWidth() config.filebrowserBrowseUrl = "/admin/ckeditor/pictures" CKEDITOR.replace( id , config )