Question

I'm using rails 4 and tinymce 4 and also the gem tinymce-rails-imageupload

I've gotten the gem installed with little trouble as follows:

config/tinymce.yml

theme: "modern"
toolbar1: bold italic | link uploadimage | undo redo | fontselect | forecolor | code | 
plugins:
  - link
  - uploadimage
  - textcolor
  - code

The problem is that when I try to upload an image from my computer I get the message:

Bad response from server

and my server logs say:

ActionController::RoutingError (No route matches [POST] "/tinymce_assets")

Is there a way to get around this without creating a new controller/table for tinymce? I really don't need to store the images. If not, could anyone point me towards a good tutorial for setting up the controller? There's an example on the gems README but my knowledge of RoR is not strong enough for me to figure out how to pass in all the required information by myself.

Was it helpful?

Solution

Generally, there is little way for you to get around this issue. You do not necessarily need to create a new "Table" in your database for tinymce, but you will either need a new controller with the create action or you could probably latch on the action on an existing controller, but that is a bit messy.

Here's a github repository that has the source code for the demo (the author of the gem wrote the demo, so it's good), it has pretty much everything you need : https://github.com/PerfectlyNormal/tinymce-rails-imageupload-demo. It uses Paperclip to do the actual upload of the images (which does require the table).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top