- Git: https://github.com/SixArm/sixarm_ruby_migration_helper_extensions
- Doc: http://sixarm.com/sixarm_ruby_migration_helper_extensions/doc
- Gem: https://rubygems.org/gems/sixarm_ruby_migration_helper_extensions
- Contact: Joel Parker Henderson, joel@sixarm.com
- Project: changes, license, contributing.
Ruby On Rails ActiveRecord MigrationHelper extensions
For docs go to http://sixarm.com/sixarm_ruby_migration_helper_extensions/doc
Want to help? We're happy to get pull requests.
To install this gem in your shell or terminal:
gem install sixarm_ruby_migration_helper_extensions
To add this gem to your Gemfile:
gem 'sixarm_ruby_migration_helper_extensions'
To require the gem in your code:
require 'sixarm_ruby_migration_helper_extensions'
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