PerfectlyNormal / tinymce-rails-imageupload

Image upload plugin for TinyMCE and Rails with the asset pipeline
MIT License
149 stars 153 forks source link

Activeadmin. WARNING: Can't verify CSRF token authenticit. #6

Closed Begler closed 12 years ago

Begler commented 12 years ago

activeadmin + tinymce-rails + tinymce-rails-imageupload. Image is stored and displayed in the window of TinyMCE, but when you try to save the database, generates "WARNING: Can't verify CSRF token authenticit". Thank you.

PerfectlyNormal commented 12 years ago

Oh, sorry about that. I disabled CSRF verification in my controller when I was just testing the functionality, and forgot to try with it enabled.

Pushed an attempt that works for me (3e2dbd4). Does it work for you now?

PerfectlyNormal commented 12 years ago

Oh, and this of course requires that your layout contains <%= csrf_meta_tag %> somewhere. If you don't use the CSRF protection, add a skip_before_filter :verify_authenticity_token in the controller this form submits to

Begler commented 12 years ago

Ok, 3e2dbd4 works fine. Thank you.

PerfectlyNormal commented 12 years ago

Great. I'll see if I can get a new gem out tomorrow

anguyen-elc commented 12 years ago

If you use following line in your main js file: //= require tinymce You will see the error message tinyMCE.$ is not a function in the JS console and the uploader will not work! My solution is to use: //= require tinymce-jquery and it seems to work well! Can you test it and make it run again?

PerfectlyNormal commented 12 years ago

Hm, yeah. I've never tried using TinyMCE without jQuery, so I just assumed it was always available. I'll take a look as soon as I get some time and see if I can get it working without jQuery.