Flattening 1:1 models

Is there a simple way to flatten 1:1 models so that the methods in one
are accessible from another? This attempt results in a stack depth
exception for any call to one of the explicitly defined methods:

class User < ActiveRecord::Base

has_one :contact

Contact.column_names.each do |col|
define_method col.to_sym do
contact.send col.to_sym
end
end

end

I tried doing this with method_missing and respond_to? as well, with
similarly poor results, so I was hoping that someone else has found a
way to cleanly map attributes in this way.

Thomas

Thomas A. wrote:

Is there a simple way to flatten 1:1 models so that the methods in one
are accessible from another? This attempt results in a stack depth
exception for any call to one of the explicitly defined methods:

If you wanted all the attributes on one model, why the heck did you
break them apart in the first place?

I suppose you could write accessors to access the Contact attributes
through User’s association, but the whole design seem completely silly
to me. Just get rid of Contact and put it’s attributes on User and be
done with it. Or, just access Contact’s attributes though the
association, like the system is designed to do.