소스 검색

Added support for Rails 5.1

Andrew Kane 7 년 전
부모
커밋
a3d91b0c90
3개의 변경된 파일12개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 0
      CHANGELOG.md
  2. 7 1
      lib/generators/blazer/install_generator.rb
  3. 1 1
      lib/generators/blazer/templates/install.rb

+ 4 - 0
CHANGELOG.md

@@ -1,3 +1,7 @@
+## 1.8.0 [unreleased]
+
+- Added support for Rails 5.1
+
 ## 1.7.10
 
 - Added support for Google BigQuery

+ 7 - 1
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

+ 1 - 1
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