> That's what I do too, like in
>
> http://techno-weenie.net/svn/projects/mephisto/trunk/db/migrate/012_rename_categories_to_sections.rb
>
> The only difference, is that I use two classes instead of one, one for the up
> and one for the down, in case they are different.  And I also give them a 
> unique
> name that uses the migration's name.  This is in case all the migrations are 
> run
> from 1-N to allow for the possibility that the same table will be modified in
> different migrations.
>
> class Section_Migrate003Up < ActiveRecord::Base
>    set_table_name 'output_state'
> end
>
> class Section_Migrate003Down < ActiveRecord::Base
>    set_table_name 'output_state'
> end
>
> Regards,
> Blair
>
> --
> Blair Zajac, Ph.D.
> <[EMAIL PROTECTED]>
> Subversion training, consulting and support
> http://www.orcaware.com/svn/

Good point.  I realize my OldAttachment model name wasn't optimal in
that case.  I was going to try something like this in my next
migration:

class RenameCategoriesToSections < ActiveRecord::Migration
  class Attachment < AR::Base
    set_table_name 'foo'
  end

  def self.up
    ...
  end
end

That way I don't need weird names, and I can still access the model as
'Attachment.'  Though, I like the idea of Up and Down migrations too. 
I'll try it out next time the issue comes up.

--
Rick Olson
http://techno-weenie.net
_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to