Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 27th, 2012  |  syntax: None  |  size: 0.28 KB  |  views: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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
clone this paste RAW Paste Data