> Thought ActiveRecord::Errors#[] looks like just an getter, it actually
> rewrites itself.
> Is this a correct behavior?

While it's a little strange the semantics are that it returns an array
which is empty if there's no error.  The implementation is something
like this:

ree-1.8.7-2011.03 :003 > h = Hash.new {|h, k| h[k] = []}
 => {}
ree-1.8.7-2011.03 :004 > h[:huh]
 => []
ree-1.8.7-2011.03 :005 > h
 => {:huh=>[]}

Which is why you see what you see.


-- 
Cheers

Koz

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" 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-core?hl=en.

Reply via email to