Skip to content

Business intelligence made simple

Added support for Rails 5.1

Andrew Kanea3d91b0c909b
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bb00cfe4..b94bb965 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 1.8.0 [unreleased]
+
+- Added support for Rails 5.1
+
## 1.7.10
- Added support for Google BigQuery
diff --git a/lib/generators/blazer/install_generator.rb b/lib/generators/blazer/install_generator.rb
index 2b0fae59..8fb8a625 100644
--- a/lib/generators/blazer/install_generator.rb
+++ b/lib/generators/blazer/install_generator.rb
@@ -22,12 +22,18 @@ module Blazer
end
def copy_migration
- migration_template "install.rb", "db/migrate/install_blazer.rb"
+ migration_template "install.rb", "db/migrate/install_blazer.rb", migration_version: migration_version
end
def copy_config
template "config.yml", "config/blazer.yml"
end
+
+ def migration_version
+ if ActiveRecord::VERSION::MAJOR >= 5
+ "[#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}]"
+ end
+ end
end
end
end
diff --git a/lib/generators/blazer/templates/install.rb b/lib/generators/blazer/templates/install.rb
index e2f264cf..b7831592 100644
--- a/lib/generators/blazer/templates/install.rb
+++ b/lib/generators/blazer/templates/install.rb
@@ -1,4 +1,4 @@
-class <%= migration_class_name %> < ActiveRecord::Migration
+class <%= migration_class_name %> < ActiveRecord::Migration<%= migration_version %>
def change
create_table :blazer_queries do |t|
t.references :creator