See the attached screenshot.
I know it's basically impossible for IDEA to validate javascript code interwined with server side (Ruby in the screenshot but could be something else), but I think it's preferrable to leave bad code unmarked than to mark good code red. This is a core issue discussed too many times: once you have too many warning/errors that can be safely ignored, you start ignoring all of them, losing IDEA's strongest feature.
Maybe javascript expression validation should be ignored for every line containing server side escapes?