Nobody has had to do something similar ? This form is basically a standard
form, with a "captcha" at the bottom... and if they mistype in the
captcha
and leave the form blank, I want all the error messages to be uniformly
displayed.
On 1/18/06, Dylan Stamat <dylans@gmail.com> wrote:>
> Hello all !
>
> I have a model being validated that spits it''s error messages on
the
> resulting page using:
> error_messages_for(:mymodel) .... Basic stuff. It''s working
perfectly.
>
> Now, I have something else I want to check on the same page (that
isn''t an
> attribute to the Model)... and am trying to add it using:
> @mymodel.errors.add_to_base("another error here")
>
> However... this doesn''t seem to be working. On the view, the
custom error
> message isn''t being displayed... only the ones from default
validation.
> When doing an inspect on the model, here is what I see:
>
> #<MyModel:0x4089b20c @errors=#<ActiveRecord::Errors:0x4087fe6c
@errors={"base"=>["another error here"]},
@base=#<MyModel
> :0x4089b20c ...>>, @new_record=true,
@password_confirmation="", @password="",
@attributes={"created_on"=>Wed Jan 18 16:35:38 PST 2006,
"status"=>true, "birthdate"=>#<Date:
4907507/2,0,2299161>, "hashed_password"=>nil,
"updated_on"=>Wed Jan 18 16:35:38 PST 2006,
"zipcode"=>"", "first_name"=>"",
"last_name"=>"", "user_name"=>"",
"email"=>""}>
>
>
> So, it looks like the custom error is being added to an hash entry called
> "base" within @errors... while there is another parameter called
@base.
>
> If anybody has any insight into this, that would be great.
> Thank you !
> => Dylan
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://wrath.rubyonrails.org/pipermail/rails/attachments/20060119/2d9d854f/attachment.html