Displaying 2 results from an estimated 2 matches for "comment_text".
Did you mean:
comments_text
2006 Feb 10
1
validation error reporting on child object
...bject
behind a page?
I have the basic blog w/ comments page (only my "entry" is a "proposal"). I have the
comments saving just fine, but I wanted to show an error if the user hits the submit
button without typing anything in the comment.
I added "validates_presence_of :comment_text" in my Comment AR class, and it appears that
the empty comment is no longer being inserted into the db. However, I can''t figure out how
to display the error message on the comment object (1 to M child of proposal) in the page.
I put an else on the call to save the comment in my add...
2008 Feb 01
4
How to sanitize _before_ going into the database?
I use a call to the sanitize method every time I render some user
input, but it would be much nicer if I could clean it up once before
putting it into the database and avoid having to call the (relatively
expensive) sanitize every time I render a page.
My first thought was to just add something like:
def message=(x)
self[:message]=sanitize(x)
end
However, the sanitize helper cannot be called