Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #10 from halida/master

Thanks!
  • Loading branch information...
commit 6d5c291e7c6dc11be917c271416c96a2debd04c1 2 parents ba9f1b0 + 64a5d21
@mattconnolly authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/rails-backup-migrate.rb
View
6 lib/rails-backup-migrate.rb
@@ -114,8 +114,8 @@ def save_db_to_yml
# into YAML on their own at all, let alone in a way that would be compatible with other databases
records.map! do |record|
record.inject({}) do |memo, (k,v)|
- memo[k] = case v
- when Mysql::Time
+ memo[k] = case v.class.name
+ when "Mysql::Time"
datetime_from_mysql_time v
else
v
@@ -144,7 +144,7 @@ def restore_db_from_yml
puts "Loading #{tbl}..." if VERBOSE
YAML.load_file("#{tbl}.yml").each do |fixture|
- ActiveRecord::Base.connection.execute "INSERT INTO #{tbl} (#{fixture.keys.join(",")}) VALUES (#{fixture.values.collect { |value| ActiveRecord::Base.connection.quote(value) }.join(",")})", 'Fixture Insert'
+ ActiveRecord::Base.connection.execute "INSERT INTO #{tbl} (#{fixture.keys.map{|k| "`#{k}`"}.join(",")}) VALUES (#{fixture.values.collect { |value| ActiveRecord::Base.connection.quote(value) }.join(",")})", 'Fixture Insert'
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.