Forum: Ruby on Rails Model Validation & Floating Attributes

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Dylan S. (Guest)
on 2006-01-19 03:22
(Received via mailing list)
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
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
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"=>"",

So, it looks like the custom error is being added to an hash entry
"base" within @errors... while there is another  parameter called @base.

If anybody has any insight into this, that would be great.
Thank you !
Dylan S. (Guest)
on 2006-01-19 19:54
(Received via mailing list)
Nobody has had to do something similar ?  This form is basically a
form, with a "captcha" at the bottom... and if they mistype in the
and leave the form blank, I want all the error messages to be uniformly
This topic is locked and can not be replied to.