Delegation

no, you do it


class User << ActiveRecord::Base  
   belongs_to :customer  
end  
class Customer << ActiveRecord::Base  
   has_one :user  
   delegate :name, :name=, :email, :email=, :to => :user  
end

Now you can refer to @customer.name and @customer.email to retrieve and set values for those attributes directly. Pretty nice, huh?

Yeah, nice stuff from wyeworks and Rails.

tags

 

Silver-button-twitter-bird