Overriding to_xml() - Why Does This Work?

In Chapter 5 of his book, Flexible Rails, Peter Armstrong's leads his readers through an exercise to override the behavior of to_xml() in ActiveRecord objects so that :dasherize would be false by default. I found his solution inelegant. I came up with a more elegant one, and it seems to work.

All I did was add the following to the very end of myapp/config/ environment.rb:

class ActiveRecord::Base   def to_xml(options=nil, &block)     super options == nil ? { :dasherize => false } : options.merge(:dasherize => false), &block   end end

But, I don't know why it works. Specifically, how come I can invoke "super" even though I am not subclassing ActiveRecord::Base, and ActiveRecord::Base's parent class (whom I believe is Object) doesn't implement to_xml()?

Can someone who is more enlightened about Ruby/Rails help me out?

Thanks!