<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>test/data/no_globalize_schema.rb</filename>
    </added>
    <added>
      <filename>test/model/active_record/migration_test.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -50,9 +50,7 @@ I18n.locale = :he
 post.title # &#1490;&#1500;&#1493;&#1489;&#1488;&#1500;&#1497;&#1497;&#1494;2 &#1513;&#1493;&#1500;&#1496;!
 &lt;/code&gt;&lt;/pre&gt;
 
-In order to make this work you currently need to take care of creating the appropriate database migrations manually. Globalize2 will provide a handy helper method for doing this in future.
-
-The migration for the above Post model could look like this:
+In order to make this work, you'll need to add the appropriate translation tables. Globalize2 comes with a handy helper method to help you do this. It's called @create_translation_table!@. Here's an example:
 
 &lt;pre&gt;&lt;code&gt;
 class CreatePosts &lt; ActiveRecord::Migration
@@ -60,21 +58,17 @@ class CreatePosts &lt; ActiveRecord::Migration
     create_table :posts do |t|
       t.timestamps
     end
-    create_table :post_translations do |t|
-      t.string     :locale
-      t.references :post
-      t.string     :title
-      t.text       :text
-      t.timestamps
-    end
+    Post.create_translation_table! :title =&gt; :string, :text =&gt; :text
   end
   def self.down
     drop_table :posts
-    drop_table :post_translations
+    Post.drop_translation_table!
   end
 end
 &lt;/code&gt;&lt;/pre&gt;
 
+Note that the ActiveRecord model @Post@ must already exist and have a @translates@ directive listing the translated fields.
+
 h2. Globalize::Backend::Static
 
 Globalize2 ships with a Static backend that builds on the Simple backend from the I18n library (which is shipped with Rails) and adds the following features:</diff>
      <filename>README.textile</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,11 @@
 module Globalize
   module Model
+  
+    class MigrationError &lt; StandardError; end
+    class UntranslatedMigrationField &lt; MigrationError; end
+    class MigrationMissingTranslatedField &lt; MigrationError; end
+    class BadMigrationFieldType &lt; MigrationError; end
+  
     module ActiveRecord
       module Translated
         def self.included(base)
@@ -31,6 +37,35 @@ module Globalize
             self.globalize_options = options
             Globalize::Model::ActiveRecord.define_accessors(self, attr_names)
           end
+          
+          def create_translation_table!(fields)
+            translated_fields = self.globalize_options[:translated_attributes]
+            translated_fields.each do |f|
+              raise MigrationMissingTranslatedField, &quot;Missing translated field #{f}&quot; unless fields[f]
+            end
+            fields.each do |name, type|
+              unless translated_fields.member? name 
+                raise UntranslatedMigrationField, &quot;Can't migrate untranslated field: #{name}&quot;
+              end              
+              unless [ :string, :text ].member? type
+                raise BadMigrationFieldType, &quot;Bad field type for #{name}, should be :string or :text&quot;
+              end 
+            end
+            translation_table_name = self.name.underscore + '_translations'
+            self.connection.create_table(translation_table_name) do |t|
+              t.references self.table_name.singularize
+              t.string :locale
+              fields.each do |name, type|
+                t.column name, type
+              end
+              t.timestamps              
+            end
+          end
+
+          def drop_translation_table!
+            translation_table_name = self.name.underscore + '_translations'
+            self.connection.drop_table translation_table_name
+          end
         end
 
         module InstanceMethods</diff>
      <filename>lib/globalize/model/active_record/translated.rb</filename>
    </modified>
    <modified>
      <diff>@@ -7,14 +7,14 @@ require 'mocha'
 $LOAD_PATH &lt;&lt; File.expand_path( File.dirname(__FILE__) + '/../lib' )
 
 class ActiveSupport::TestCase
-  def reset_db!
+  def reset_db!( schema = 'schema' )
     ::ActiveRecord::Migration.verbose = false   # Quiet down the migration engine
     ::ActiveRecord::Base.establish_connection({
       :adapter =&gt; 'sqlite3',
       :dbfile =&gt; ':memory:'
     })
     ::ActiveRecord::Base.silence do
-      load File.expand_path(File.join(File.dirname(__FILE__), 'data', 'schema.rb'))
+      load File.expand_path(File.join(File.dirname(__FILE__), 'data', schema + '.rb'))
     end
   end
 end
\ No newline at end of file</diff>
      <filename>test/test_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>97586bb5e34c0a6687e75884332623ab5130a16a</id>
    </parent>
  </parents>
  <author>
    <name>Joshua Harvey</name>
    <email>joshmh@gmail.com</email>
  </author>
  <url>http://github.com/joshmh/globalize2/commit/4e0eda4d9935be3c637cbb9966114b54af384a14</url>
  <id>4e0eda4d9935be3c637cbb9966114b54af384a14</id>
  <committed-date>2009-01-15T12:40:43-08:00</committed-date>
  <authored-date>2009-01-15T12:40:43-08:00</authored-date>
  <message>added create_translation_table\!</message>
  <tree>e27104529c99db8209c97017d9aea05b68487d03</tree>
  <committer>
    <name>Joshua Harvey</name>
    <email>joshmh@gmail.com</email>
  </committer>
</commit>
