This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

product.rb

By: a guest on Sep 19th, 2012  |  syntax: None  |  size: 0.30 KB  |  views: 28  |  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. class Product < ActiveRecord::Base
  2.  
  3.         attr_accessible :name, :price, :category, :descrption, :author
  4.         serialize :data, ActiveRecord::Coders::Hstore
  5.  
  6.         def author
  7.                 properties && properties["author"]
  8.         end
  9.  
  10.         def author=(value)
  11.                 self.properties = (properties || {}).merge("author" => value)
  12.         end
  13. end
clone this paste RAW Paste Data