Skip to content

Instantly share code, notes, and snippets.

@zlw
Created June 9, 2012 14:41
Show Gist options
  • Save zlw/2901225 to your computer and use it in GitHub Desktop.
Save zlw/2901225 to your computer and use it in GitHub Desktop.
class Product < ActiveRecord::Base
include HstoreAccessor
hstore_accessor :data, :price, :weight
end
p = Product.new
p.price = '$45'
p.price #=> $45
p.weight = '100kg'
p.weight #=> 100kg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment