开发者

SO WMD editor javascripts load RoutingError

开发者 https://www.devze.com 2023-03-13 01:41 出处:网络
I\'m sure the answer to this is very straightforward: I\'m trying to use the WMD editor from derobins (Here) with my rails app (it\'s the one on SO that I\'m using as I type). But for some reason the

I'm sure the answer to this is very straightforward:

I'm trying to use the WMD editor from derobins (Here) with my rails app (it's the one on SO that I'm using as I type). But for some reason the js files (showdown.js and wmd.js) aren't loading.

In the console I'm getting the errors:

ActionController::RoutingError (No route matches "/public/javascripts/wmd") ActionController::RoutingError (No route matches "/public/javascripts/showdown")

... despite the fact that both files - wmd.js and showdown.js are in [myapp]/public/javascri开发者_Python百科pts.

The readme says to include the files like this:

  <script type="text/javascript" src="showdown.js"></script>

... which I tried but this didn't work (for obvious reasons, I think).

So I included them like this:

<script type="text/javascript" src="/public/javascripts/wmd.js"></script>
<script type="text/javascript" src="/public/javascripts/showdown.js"></script>

I've tried these with .. at the start (e.g. src="..public/"), without the /, and with and without the .js.

Any help gratefully received.


Simple solution: changed the includes to

<%= javascript_include_tag 'showdown' %>
<%= javascript_include_tag 'wmd' %>

But still no idea why it wasn't working before.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号