Hi all

I have the following code in my controller:

    if @comment.valid?
      captcha_url =
"http://captchator.com/captcha/check_answer/#{captcha_code}/#...@comment.captcha}";
      result = open(captcha_url)
      unless result.read == "1"
        @comment.errors.add(:captcha, "Captcha wurde nicht korrekt
eingegeben")
        raise "#...@comment.valid?}"
      end
    end

Although I'm adding an error to :captcha, when I raise @comment.valid?
on the next line this still gives me true! Why is that? I just added an
error to @comment, didn't I?!

Maybe it's because I'm only using an attr_accessor for captcha?

class Comment < ActiveRecord::Base
  validates_presence_of :captcha
  attr_accessor :captcha
end

Thanks
Josh
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to