I''m having trouble with my Ajax comments, but only when someone clicks
the submit button when there''s no comment. How can I handle this in my
code?
Do I use "rescue nil" or something?
Here''s my controller:
def comments
content = Content.find(params[:id])
@comment = Comment.new(params[:comment])
content.comments << @comment
content.save
@comment.save
@comment_count = Comment.count("content_id=#{params[:id]}")
render_without_layout
end
If the comment is blank, then do I want to rescue the nil, then "render
:text => ''Please fill out the fields.''"? Then in my
remote form
options, on the :update, I could have:
:update => {:success => ''the_right_div'',:failure =>
''error_div''}
????
This is how I interpret the overall process, but I don''t know the
correct syntax on how to do this with the resue, and what I check for.
I just want nothing to happen when the user clicks the "submit
comment"
button when there''s nothing to submit.
Please HELP!
Thanks in advance for any tips - this forum has really helped me out!
--
Posted via http://www.ruby-forum.com/.