Displaying ruby code in a view

20 views
Skip to first unread message

Chris Kacerguis

unread,
Nov 3, 2014, 8:23:48 PM11/3/14
to rubyonra...@googlegroups.com
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.

Chris

Frederick Cheung

unread,
Nov 4, 2014, 5:39:27 AM11/4/14
to rubyonra...@googlegroups.com


On Tuesday, November 4, 2014 1:23:48 AM UTC, Chris Kacerguis wrote:
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.


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)

Fred
Reply all
Reply to author
Forward
0 new messages