Posts filed under 'Rails'

Mumboe is now on GitHub

During development of the Mumboe Contract Management product we have created and modified several open source Ruby gems and Rails plug-ins. While that code has been on GitHub, it has been managed under individual developer’s private accounts. We have now consolidated development under a single Mumboe account for all of our open source projects. The Mumboe GitHub user currently hosts our forks of:

  • aasm Fork of the acts_as_state_machine (AASM) gem. The fork adds support for logging state changes in a DRY way.
  • amatch Fork of the Approximate string matching gem. This fork incorporates Michal Granger’s Ruby 1.9 patch
  • has_easy Easy access and creation of “has many” relationships for ActiveRecord models. Forked to fix some bugs around validation errors.
  • param_protected A Rails plug-in that provides param_protected and param_accessible methods on controllers. This fork allows the use of a Proc for generating the action list in include/exclude from protection.
  • soap4r Modified soap4r library to run on Ruby 1.9

Add comment June 24th, 2009 Author: ScottD

More Flexible Rails Migrations

Before we moved from our own internally developed PHP framework to using Ruby on Rails, I had written a database migration library that mimics Rail’s with two key differences:

  1. It allowed for retroactive running of migrations with versions at or below the current database version.
  2. It allowed a developer to force run a migration, even if that migration had already been run before.

Point one solves the problem where you have multiple developers sharing the same development database and all writing migrations at the same time. For instance, you create a migration 002_blah, but before you run it and check it in, another developer created, ran and checked in migration 002_bleck. By default in Rail’s, your 002_blah migration will never be run because the database is already on version 002. My library instead says “ok, I’m on version 002, but lets see if there any new migrations at or below that version that have not been run yet.”

Point two is dangerous and indeed has lead our database to get all mucked up more than a few times, but hey, it’s a feature no one is forcing you to use. The “force run” feature lets you run a migration (either up or down) even if it has already been run before. This feature is nice for when you realize you made a mistake in an already run migration and instead of making a new migration, you just want to edit and fix the existing one. You “force down” it, edit/fix it, then “force up” it.

I made a plugin for Rails called Retroactive Migrations (r_migrations) that implements this behavior. For installation and documentation, please see my personal blog post about it.

Add comment October 22nd, 2007 Author: Christopher Bottaro


Calendar

July 2010
M T W T F S S
« Oct    
 1234
567891011
12131415161718
19202122232425
262728293031  

Links

Posts by Month

Posts by Category