I need to supply my users with js code, so I have text area:
<%= text_area_tag 'body', "//<script>...</script>"%>
I can’t make it working. I know how to do it with variables from controllers :
@payKey = @xml["payKey"].to_s()
"#{@payKey}"
EDIT. FUll text to print:
<script>var _p_g={id:@website.id};</script>
<script src="..."></script>
and print it in view, but gave me error:
E:/myapp/myapp_prev/myapp/app/controllers/websites_controller.rb:12: unknown regexp option - j
E:/myapp/myapp_prev/myapp/app/controllers/websites_controller.rb:12: syntax error, unexpected tSTRING_BEG, expecting keyword_end
<></script>"
^
So what would be better way to solve this trouble ?
The problem appears to be that you’re putting double quotes inside of other quotes, causing a syntax error.
Try this: