Skip to content
This repository has been archived by the owner on Apr 18, 2021. It is now read-only.
/ hstore_attributes Public archive

Provides methods like hstore_reader or hstore_writer for accessing your Hstore data like any other attributes.

License

Notifications You must be signed in to change notification settings

qoobaa/hstore_attributes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HstoreAttributes

Provides methods like hstore_reader or hstore_writer for accessing your Hstore data like any other attributes. It also gives you a possibility to typecast the value.

Usage

class Product < ActiveRecord::Base
  extend HstoreAttributes

  # The hstore column is named 'data'
  hstore_accessor :data, :description
  hstore_accessor :data, :price, :tax, type_cast: :to_i
  hstore_accessor :data, :available_from, type_cast: ->(value) { value.to_s.to_date }
end

Installation

Add this line to your application's Gemfile:

gem "hstore_attributes"

And then execute:

$ bundle

Or install it yourself as:

$ gem install hstore_attributes

About

Provides methods like hstore_reader or hstore_writer for accessing your Hstore data like any other attributes.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages