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
--
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.