An open API service indexing awesome lists of open source software.

https://github.com/sixarm/sixarm_ruby_migration_helper_extensions

SixArm.com » Ruby » Migration Helper extensions and extras
https://github.com/sixarm/sixarm_ruby_migration_helper_extensions

extension gem migration rails ruby

Last synced: about 2 months ago
JSON representation

SixArm.com » Ruby » Migration Helper extensions and extras

Awesome Lists containing this project

README

          

# SixArm.com → Ruby →
Migration Helper Extensions for Ruby On Rails ActiveRecord

[![Gem Version](https://badge.fury.io/rb/sixarm_ruby_migration_helper_extensions.svg)](http://badge.fury.io/rb/sixarm_ruby_migration_helper_extensions)
[![Build Status](https://travis-ci.org/SixArm/sixarm_ruby_migration_helper_extensions.png)](https://travis-ci.org/SixArm/sixarm_ruby_migration_helper_extensions)
[![Code Climate](https://api.codeclimate.com/v1/badges/c0c87ef7543e0da158f5/maintainability)](https://codeclimate.com/github/SixArm/sixarm_ruby_migration_helper_extensions/maintainability)

* Git:
* Doc:
* Gem:
* Contact: Joel Parker Henderson,
* Project: [changes](CHANGES.md), [license](LICENSE.md), [contributing](CONTRIBUTING.md).

## Introduction

Ruby On Rails ActiveRecord MigrationHelper extensions

For docs go to

Want to help? We're happy to get pull requests.

## Install

### Gem

To install this gem in your shell or terminal:

gem install sixarm_ruby_migration_helper_extensions

### Gemfile

To add this gem to your Gemfile:

gem 'sixarm_ruby_migration_helper_extensions'

### Require

To require the gem in your code:

require 'sixarm_ruby_migration_helper_extensions'

## Examples

Migration:

require "sixarm_ruby_migration_helper_extensions"
class CreateItems < ActiveRecord::Migration

def self.up
create_table 'items' do |t|
t.timestamps
t.name
t.email
t.phone
t.height
t.weight
t.latitude
t.longitude
end
end

def self.down
drop_table 'items'
end

end

The result is an item class with fields of the various data types:

item = Item.new
item.name = "Statue Of Liberty"
item.email = "liberty@example.com"
item.phone = "+1-212-363-3200"
item.height = 46.50
item.weight = 204116566
item.latitude = 40.68913
item.longitude = -74.0446
item.save