Sharing methods among migrations?

Folks,

I’m using migrations in my app (why wouldn’t you?) but using the execute
method so that I can layer in check constraints/foreign keys and some
postgres-specific data integrity niceties. Anyway:

Say I want to share methods among migrations, for instance to centralize
column definitions. I have about 15 or so columns in multiple tables
that will be defined with the same check constraints and type, the only
difference being the name.

I guess I’m looking to create helper methods to share amongst all my
migrations. Thoughts?

I’d imagine I’d create a class that has ActiveRecord::Migration as a
parent, and then put the methods in there and have my migrations inherit
from that. Where would I put this new class?

-DJCP

Forget it.

AWDwR has a pretty good intro to migration helpers, and

http://seb.box.re/articles/2006/07/29/foreign-key-and-rails-migration

will give you the basics, too.

-DJCP

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs