Permalink
Browse files

Fixed migration from acts_as_paranoid, tweaked test data

  • Loading branch information...
varyform committed Mar 3, 2010
1 parent 62c894a commit 1941d3eaf2dc1bd27ff14f26051d7822fc3cae51
Showing with 5 additions and 5 deletions.
  1. +3 −4 lib/acts_as_archive/base/destroy.rb
  2. +2 −1 spec/spec_helper.rb
@@ -26,13 +26,12 @@ def copy_to_archive(conditions, import=false)
end
else
insert_cols << 'deleted_at'
-
- insert_cols.map! { |col| connection.quote_column_name(col) }
- select_cols.map! { |col| connection.quote_column_name(col) }
-
select_cols << "'#{Time.now.utc.to_s(:db)}'"
end
+ insert_cols.map! { |col| connection.quote_column_name(col) }
+ select_cols.map! { |col| col =~ /^\'/ ? col : connection.quote_column_name(col) }
+
connection.execute(%{
INSERT INTO archived_#{table_name} (#{insert_cols.join(', ')})
SELECT #{select_cols.join(', ')}
View
@@ -43,7 +43,7 @@ def create_records(klass=Article, values={})
end
end
connection.execute(%{
- INSERT INTO #{table} (#{cols.collect { |c| "#{c}" }.join(', ')})
+ INSERT INTO #{table} (#{cols.collect { |c| "#{connection.quote_column_name(c)}" }.join(', ')})
VALUES (#{vals.join(', ')})
})
klass.find(x)
@@ -69,6 +69,7 @@ def establish_test_db
connection.create_table(:articles) do |t|
t.string :title
t.string :body
+ t.boolean :read # break mysql w/o quotation
end
# Load the model
load "#{SPEC}/db/models/article.rb"

0 comments on commit 1941d3e

Please sign in to comment.