I just typed a long post with my model, controller and view file
snippets, and lost it
Here goes again:
I have a 2 postgres tables: files and lines. Files simply has an id
and a string name. Lines has a file_id, line_number and line_text. I
have the associations set up nicely so:
@lines = File.find(params[:id]).lines
works nicely. The only problem is that if a line has a ‘<’ in it,
anything after the ‘<’ is getting eaten (ie not showing up).
Any ideas?
On 3 Oct 2007, at 17:08, Reacher wrote:
before
you display it.
Maybe…
That’s exactly what is happening (I figured it out right after I
posted). I looked in the page source and all my text was there. the
browser sees the ‘<’ and tried to resolve a tag out of it. when it
can’t all the text between it and the next valid closing tag is
eaten. I guess I’ll have to replace any ‘<’ with ‘<’ in my
controller before passing it to the view
The h function will do that.
Fred
browser sees the ‘<’ and tried to resolve a tag out of it. when it
can’t all the text between it and the next valid closing tag is
eaten. I guess I’ll have to replace any ‘<’ with ‘<’ in my
controller before passing it to the view
Escape special characters in HTML, namely &"<>
CGI::escapeHTML('Usage: foo “bar” ')
# => “Usage: foo “bar” <baz>”