Skip to content
Let's you write slightly slimmer Rails migrations.
Ruby
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
.gitignore
Gemfile
Gemfile.lock
MIT-LICENSE
README.rdoc
Rakefile
init.rb
slim_migrations.gemspec

README.rdoc

SlimMigrations

Turns

class AddWebsiteToUser < ActiveRecord::Migration
  def self.up
    add_column :users, :website, :string
  end

  def self.down
    remove_column :users, :website
  end
end

into

migration do
  def up
    add_column :users, :website, :string
  end

  def down
    remove_column :users, :website
  end
end

Extras

  • Modifies the rails generator to use the slim syntax

  • Helper task for converting existing migrations: rake slim_migrations:update_syntax

Install

Rails 3.2

# in your Gemfile
gem 'slim_migrations', '~> 3.2.1'

Rails 3.1

# as plugin:
rails plugin install git://github.com/janlelis/slim_migrations.git -r 3.1
# or in your Gemfile:
gem 'slim_migrations', '~> 3.1.1'

Rails 3.0

# as plugin:
rails plugin install git://github.com/janlelis/slim_migrations.git -r 3.0
# or in your Gemfile:
gem 'slim_migrations', '~> 3.0.1'

Rails 2.3

# as plugin:
script/plugin install git://github.com/janlelis/slim_migrations.git -r 2.3
# or in your config/environment.rb
config.gem 'slim_migrations', :version => '~> 2.3.1'

Credits

Blog post: rbjl.net/53-three-little-tips-for-slimmer-rails-migrations

Thanks to contributions from: Manuel Meurer

MIT-LICENSE, J-_-L

Something went wrong with that request. Please try again.