SHARE
TWEET

Untitled

a guest Feb 27th, 2012 12 Never
  1.   def self.addr_attr *names
  2.     for name in names
  3.       define_method name do
  4.         self.address[name] if self.address
  5.       end
  6.       define_method "#{name}=" do |v|
  7.         self.address ||= Address.new
  8.         self.address[name] = v
  9.         self.address.save
  10.       end
  11.     end
  12.   end
RAW Paste Data
Top