Skip to content

Instantly share code, notes, and snippets.

@belison
Created January 19, 2012 02:48
Show Gist options
  • Save belison/1637363 to your computer and use it in GitHub Desktop.
Save belison/1637363 to your computer and use it in GitHub Desktop.
class Vehicle < ActiveRecord::Base
#has field :options, type hstore
end
class Truck < Vehicle
scope :six_foot_bed, where("options -> 'bed_length' = '6' ")
def bed_length=(value)
options['bed_length'] = value
end
def bed_length
options['bed_length']
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment