If you haven't heard, an "error 18" means "the error is 18 inches from the screen." Which would mean that I totally get that this could just be me being stupid.
However, for some reason I'm thinking this violates the normal behavior of an Array object, so I'm curious as to if I'm doing something wrong here, or if something really is buggy in - or a feature of - Rails 3. So here's the deal: I want to SET - not append to - the errors array on certain conditions in my application. Through testing I've discovered that when you use the = operator on errors[:base], it *appends* to the array instead of replacing it. This is totally different from a standard Array object, yet errors[:base].class returns "Array". Observe: Loading development environment (Rails 3.0.0.beta4) ree-1.8.7-2010.02 > u = User.new => #<User id: nil, blah blah blah stuff for new user object> ree-1.8.7-2010.02 > u.errors[:base] = ["Test"] => ["Test"] ree-1.8.7-2010.02 > u.errors[:base] = ["Testing"] => ["Testing"] ree-1.8.7-2010.02 > u.errors[:base] => [["Test"], ["Testing"]] ree-1.8.7-2010.02 > u.errors[:base].class => Array ree-1.8.7-2010.02 > x = [] => [] ree-1.8.7-2010.02 > x = ["test"] => ["test"] ree-1.8.7-2010.02 > x = ["testing"] => ["testing"] As you can see, instantiating a normal Array object and then calling the = operator *replaces* the contents of the array with the new array, a pretty standard and expected pattern. But doing the same thing on errors[:base] of an ActiveRecord object *appends* to the array, even though it's class is Array. What could I be doing wrong here? Or is this just a feature of Rails 3? Should I submit a ticket via Lighthouse? Again, I'm fully willing to accept that I f'd up here. so feel free to tell me what I'm doing wrong. Thanks. -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

