WYMEditor and Rails 3.2 Asset Pipeline

I'm having trouble getting WYMEditor to work correctly in Rails 3.2 production mode with an asset pipeline. Here is my setup:

# app/assets/javascripts/application.js //= require jquery //= require jquery_ujs //= require twitter/bootstrap //= require wymeditor/jquery.wymeditor.min //= require_tree . 

WYMEditor files are located in vendor/assets/javascripts/wymeditor/*

 # in app/views/layouts/application.html.erb just above closing </body> tag <script type="text/javascript"> $(document).ready(function() { $('textarea').wymeditor(); }); </script> 

In development mode, everything works fine. However, after I did rake assets:clean and rake assets:precompile and started my rails s -e production server, WYMEditor no longer works. I looked at public/assets/application.js , and it looks like WYMEditor code was included in this file. However, errors that, it seems to me, indicate that WYMEditor is looking for some of its files relative to the page on which WYMEditor is enabled, and not in the public/assets/wymeditor that is created during the pre-compilation process:

 Started GET "/users/lang/en.js" for 127.0.0.1 at 2012-10-09 16:11:12 -0700 ActionController::RoutingError (No route matches [GET] "/users/lang/en.js"): Started GET "/users/skins/default/skin.js" for 127.0.0.1 at 2012-10-09 16:11:12 -0700 ActionController::RoutingError (No route matches [GET] "/users/skins/default/skin.js"): Started GET "/users/iframe/default/wymiframe.html" for 127.0.0.1 at 2012-10-09 16:11:12 -0700 ActionController::RoutingError (No route matches [GET] "/users/iframe/default/wymiframe.html"): [snipped stack traces and more similar error messages] 

After a lot of Google searches, I came across a page that showed that WYMEditor is unhappy when its code is included in application.js and that it should be in a separate folder. However, I do not know whether this is true or not. What would be the recommended way to get WYMEditor to work?

+4
source share

Source: https://habr.com/ru/post/1438773/


All Articles