javascriptruby-on-railswmdrails-routingwmd-editor

SO WMD editor javascripts load RoutingError


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/javascripts.


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.


Solution

  • Simple solution: changed the includes to

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

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