module ActiveRecord::Store

def read_store_attribute(store_attribute, key) # :doc:

:doc:
def read_store_attribute(store_attribute, key) # :doc:
  accessor = store_accessor_for(store_attribute)
  accessor.read(self, store_attribute, key)
end

def store_accessor_for(store_attribute)

def store_accessor_for(store_attribute)
  type_for_attribute(store_attribute).tap do |type|
    unless type.respond_to?(:accessor)
      raise ConfigurationError, "the column '#{store_attribute}' has not been configured as a store. Please make sure the column is declared serializable via 'ActiveRecord.store' or, if your database supports it, use a structured column type like hstore or json."
    end
  end.accessor
end

def write_store_attribute(store_attribute, key, value) # :doc:

:doc:
def write_store_attribute(store_attribute, key, value) # :doc:
  accessor = store_accessor_for(store_attribute)
  accessor.write(self, store_attribute, key, value)
end