Giter VIP home page Giter VIP logo

postgres_ext's Introduction

PostgresExt

Adds support for missing PostgreSQL data types to ActiveRecord.

Build Status Code Climate

Looking for help?

If it is a bug please open an issue on Github. If you need help using the gem please ask the question on Stack Overflow. Be sure to tag the question with DockYard so we can find it.

Installation

Add this line to your application's Gemfile:

gem 'postgres_ext'

And then execute:

$ bundle

Or install it yourself as:

$ gem install postgres_ext

Usage

Just require 'postgres_ext' and use ActiveRecord as you normally would! postgres_ext extends ActiveRecord's data type handling.

Usage Notes

Avoid the use of in place operators (ie Array#<<). These changes are not tracked by Rails (this issue) explains why). In place modifications also modify the default object.

Assuming we have the following model:

create_table :items do |t|
  t.string :names, :array => true, :default => []
end

class Item < ActiveRecord::Base
end

The following will modify the default value of the names attribute.

a = Item.new
a.names << 'foo'

b = Item.new
puts b.names
# => ['foo']

The supported way of modifying a.names:

a = Item.new
a.names += ['foo']

b = Item.new
puts b.names
# => []

As a result, in place operators are discouraged and will not be supported in postgres_ext at this time.

Authors

Dan McClain twitter github

postgres_ext's People

Contributors

danmcclain avatar bcardarella avatar skandragon avatar jagregory avatar duggiefresh avatar alno avatar calebwoods avatar gilltots avatar vongruenigen avatar daikini avatar mariovisic avatar omcnet avatar doon avatar legendetm avatar turadg avatar

Watchers

James Cloos avatar Angel(Xianhui) Rodas Feng avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.