diff options
| author | technoweenie <technoweenie@567b1171-46fb-0310-a4c9-b4bef9110e78> | 2008-01-11 17:54:07 +0000 |
|---|---|---|
| committer | technoweenie <technoweenie@567b1171-46fb-0310-a4c9-b4bef9110e78> | 2008-01-11 17:54:07 +0000 |
| commit | 1462f90157a365e0eec8f6f31db3f207b4d9d414 (patch) | |
| tree | 8a263520ec6e8de19b66c9d4b56bf381d76a4b71 | |
| parent | ab9d369ca60534d01e9f88a4c457907a159fdb83 (diff) | |
fix type_col typo [MoisesMachado]
git-svn-id: http://svn.techno-weenie.net/projects/plugins/acts_as_versioned@3089 567b1171-46fb-0310-a4c9-b4bef9110e78
| -rw-r--r-- | lib/acts_as_versioned.rb | 4 | ||||
| -rw-r--r-- | test/fixtures/migrations/1_add_versioned_tables.rb | 1 | ||||
| -rw-r--r-- | test/migration_test.rb | 6 |
3 files changed, 7 insertions, 4 deletions
diff --git a/lib/acts_as_versioned.rb b/lib/acts_as_versioned.rb index 129f24a67..8043b9cba 100644 --- a/lib/acts_as_versioned.rb +++ b/lib/acts_as_versioned.rb @@ -487,8 +487,8 @@ module ActiveRecord #:nodoc: self.connection.add_column versioned_table_name, versioned_inheritance_column, type_col.type, :limit => type_col.limit, :default => type_col.default, - :scale => col.scale, - :precision => col.precision + :scale => type_col.scale, + :precision => type_col.precision end if updated_col.nil? diff --git a/test/fixtures/migrations/1_add_versioned_tables.rb b/test/fixtures/migrations/1_add_versioned_tables.rb index cf1650b8d..5007b16ad 100644 --- a/test/fixtures/migrations/1_add_versioned_tables.rb +++ b/test/fixtures/migrations/1_add_versioned_tables.rb @@ -3,6 +3,7 @@ class AddVersionedTables < ActiveRecord::Migration create_table("things") do |t| t.column :title, :text t.column :price, :decimal, :precision => 7, :scale => 2 + t.column :type, :string end Thing.create_versioned_table end diff --git a/test/migration_test.rb b/test/migration_test.rb index 703dc6bc7..3cef74195 100644 --- a/test/migration_test.rb +++ b/test/migration_test.rb @@ -21,11 +21,13 @@ if ActiveRecord::Base.connection.supports_migrations? assert_raises(ActiveRecord::StatementInvalid) { Thing.create :title => 'blah blah' } # take 'er up ActiveRecord::Migrator.up(File.dirname(__FILE__) + '/fixtures/migrations/') - t = Thing.create :title => 'blah blah', :price => 123.45 + t = Thing.create :title => 'blah blah', :price => 123.45, :type => 'Thing' assert_equal 1, t.versions.size # check that the price column has remembered its value correctly - assert_equal 123.45, t.versions.first.price + assert_equal t.price, t.versions.first.price + assert_equal t.title, t.versions.first.title + assert_equal t[:type], t.versions.first[:type] # make sure that the precision of the price column has been preserved assert_equal 7, Thing::Version.columns.find{|c| c.name == "price"}.precision |
