Reputation: 301
While writing some HAML for a Rails application, I tried to use the :javascript filter to embed some inline javascript into the document. Whenever I try to load the page, Rails complains with Invalid filter name ":javascript".
The code I am trying to include is the following:
:javascript
$(document).ready(function() {
$('#variants').editableTableWidget();
});
Why is rails complaining?
Upvotes: 0
Views: 637
Reputation: 79783
You seem to have somehow got an extra character in your code, a “soft hyphen” (U+00AD), between the s
and c
of “javascript”. It doesn’t show up in the HTML, but copying your code and pasting into the terminal to run it reveals the extra character, and the error message appears as
Invalid filter name ":javas-cript".
(here I’ve replaced the soft hyphen with a normal one so that it shows up in the HTML)
It might not show up in your editor, but if you advance your cursor over the word one character at a time you may notice you need an extra key press between the s
and c
.
To fix it, just delete this extra character. If you can’t find it or are unsure, delete the whole javascript
and retype it.
Upvotes: 2