Displaying ruby code in a view

Hello All,

I’m pretty new to Rails / Ruby development, so please bear with me if this is a RTFM question.

I’m trying to output ruby snippets (snippets are stored in a file) in my view, but erb/rails keeps trying to parse the code. Is there any way I can get Rails to not to parse the Ruby and just output it as text?

I hope that makes sense.

Thanks in advance for any advice / direction.


if it’s not in <% tags then it should be output as is (although you may need to escape it to stop the browser interpreting as malformed html - depending on how you are including these snippets this might be done automatically)