Patches for the easy-fckeditor rails plugin
A couple of days ago I discovered the wonderful easy-fckeditor Rails plugin. It’s a fork of the main fckeditor plugin, integrating the EasyUpload plugin. With this marvellous piece of software you can integrate a visual text editor in no time; what is more, file attachments are included out of the box, with no need to implement your own server-side upload actions.
The plugin is fantastic, but there was a small glitch with Rails 2.2, which forbade to upload files. Files upload is an ajaxed action, so you won’t see any error, unless you use firebug, which revealed this problem:
undefined method 'relative_url_root'After some googling I found this patch which anyway is for the fckeditor plugin. So I tweaked it a bit and here’s the working patch for easy-fckeditor:
app/controllers/fckeditor_controller.rb
198 | uploaded = request.relative_url_root.to_s + "#{UPLOAD_FOLDER}/#{params[:Type]}" |
becomes:
198 | uploaded = ActionController::Base.relative_url_root.to_s+"#{UPLOAD_FOLDER}/#{params[:Type]}" |
lib/fckeditor.rb
38 | js_path = "#{controller.relative_url_root}/javascripts" |
becomes:
38 | js_path = "#{ActionController::Base.relative_url_root}/javascripts" |
There was another small glitch, due to the interaction with safe_erb.
safe_erb is a super useful plugin which raises an error whenever unsanitized output is printed. This way you never risk forgetting to sanitize your stuff. The problem here is that html text is necessarily not sanitized, otherwise all the html tags would be lost. The trick here is to tell ruby that he can trust those strings. It’s not the most secure solution, but I guess it’s better to have everything but the html text sanitized than nothing…
libfckeditor.rb
15 | value = value.nil? ? "" : value |
becomes:
15 | value = value.nil? ? "" : value.untaint() |
I sent this patches to Gaston Ramos, the plugin maintainer, but you can follow my code if you stumble into this issues before the patches integration.
Davide







2009-04-04 at 12.18 pm
It doesn’t work with rails 2.2
NoMethodError (undefined method
relative_url_root' for #<ActionController::Request:0xb5a20bc4>): vendor/plugins/easy-fckeditor/app/controllers/fckeditor_controller.rb:198:inuploaddirectorypath’ veIt is still there…
2009-04-21 at 4.30 am
Hi, I’m using rails 2.1.1 and already made the changes you suggest and I’m still getting that error. Any idea?
urlroot = ActionController::Base.relativeurlroot.tos jspath = #{ActionController::Base.relativeurl_root}/javascripts”
Thanks
2009-04-22 at 3.10 am
Thank you very much… it solves my problem.
2009-07-08 at 6.23 pm
Now getting:
Found a reference to this in rail.lighthouse.com as well as a bug but it is marked resolved.
Running ruby 1.8.6, Rails 2.3.2 on MacOS 1.5.7 (9J61)
Anybody else seen this?
Thanks, Pi.
2009-12-29 at 3.42 pm
Very nice blog, your article is interesting, i have bookmarked it for future referrence
2010-03-13 at 12.15 pm
Hello There,
It’s really very simple & quick solution. Thank you very much…..
2010-03-25 at 7.18 am
hi, I m not able to upload my image through fckeditor
its giving error as Unknown error creating folders, can anybody help me , i need it urgently.
2011-09-09 at 10.54 pm
Fantastic goods from you, man. I’ve bear in mind your stuff previous to and you are simply extremely great. I actually like what you have received right here, really like what you are stating and the way by which you say it. You’re making it enjoyable and you still care for to stay it sensible. I cant wait to learn far more from you. This is actually a great website.
2012-03-19 at 9.33 am
Itˇ¦s in reality a great and helpful piece of information. Iˇ¦m satisfied that you simply shared this useful info with us. Please stay us up to date like this. Thanks for sharing.
2012-03-24 at 8.10 am
Last year we travelled with our dog on a flight from Toronto to Cairo Egypt. We have a letter from our doctor stating that the dog must travell with my husband. This paperwork was presented to the woman at the counter of KLM ( she announced herself as a supervisor). She took one look at the letter and told my husband to get some controll over himself rather than get a dog. I complained to KLM in a written letter after having to pay $200.00 at the airport. KLM sent me back an apology for her rude behaviour and a voucher on Delta airlines. They also stated in their letter that the supervisor did not break any rules. On my return trip from Cairo to Toronto I again presented the letter to the supervisor in Cairo Airport who said they no longer carried support dogs and that I must pay another $200.00. I handed over the vouchers given me on my trip to Cairo and was told by the supervisor that these vouchers were for Delta and not KLM. I have travelled KLM for years with this dog and no problem this year was a trip from hell. I have never travelled on Delta airlines and have no problem with them, The ground crew at Toront International Airport was rude, discourteous and lacking compassion. I do not feel that we have had just resolution to our case with KLM and am therefore appealing to you for help in the resolution of this matter.We have a letter from our family physician who has been treating my husbandWe have a harness and tags on the dog.He is small and fits under the seat in his kennelThe airline does not give him food or waterThe airline was notified and he was on the data base eventhough the supervisor said we failed to notify them that the dog would be travelling with us.We would now like the reimbursement of the $400.00 dollars paid out ($200.00 x $200.00)Sincerely;Eileen & Fouad El-Sayed
2012-03-24 at 8.53 am
Also to respond to Maximisses many of the benefits from nutritional or botanical supplements (as supported by scientific research) are best had from concentrated doses only available in supplement form. It would be impossible to consume the amount of food required to reach those levels. While I am a proponent for eating well first and have yet to take on the regimen and cost of regular supplements, if the company is sound, I would consider this plug a fair tip for travelers.
2012-05-17 at 1.11 am
I would also like to add that in case you do not actually have an insurance policy otherwise you do not belong to any group insurance, you may well take advantage of seeking aid from a health agent. Self-employed or those with medical conditions commonly seek the help of the health insurance dealer. Thanks for your article.