Skip to content

Commit 0212bb4

Browse files
author
Jake Moffatt
committed
Add compatibility for Rails 3
1 parent 70f4f8a commit 0212bb4

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

lib/fix_db_schema_conflicts/schema_dumper.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
require 'delegate'
2+
13
module ActiveRecord
24
# = Active Record Schema Dumper
35
#
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module FixDBSchemaConflicts
2-
VERSION='1.0.0'
2+
VERSION='1.0.1'
33
end

lib/tasks/db.rake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ namespace :db do
22
namespace :schema do
33
task :dump do
44
puts "Dumping database schema with fix-db-schema-conflicts gem"
5-
filename = ENV['SCHEMA'] || File.join(ActiveRecord::Tasks::DatabaseTasks.db_dir, 'schema.rb')
5+
filename = ENV['SCHEMA'] || if defined? ActiveRecord::Tasks::DatabaseTasks
6+
File.join(ActiveRecord::Tasks::DatabaseTasks.db_dir, 'schema.rb')
7+
else
8+
"#{Rails.root}/db/schema.rb"
9+
end
610
rubocop_yml = File.expand_path('../../../.rubocop_schema.yml', __FILE__)
711
`rubocop --auto-correct --config #{rubocop_yml} #{filename}`
812
`sed -E -e 's/, +/, /g' #{filename} > db/schema.fixed.rb`

0 commit comments

Comments
 (0)