From c324b1d1c215768c259c4cf9c4ba36ca1b6b3727 Mon Sep 17 00:00:00 2001 From: Xanders Date: Wed, 13 Apr 2016 01:12:59 +0300 Subject: [PATCH 1/3] Rails 5 support Need for changes in table creation because of that commit: https://github.com/rails/rails/commit/fc88e4a5c317830686e3160bb4ba95e49c681b12 --- lib/mini_record/auto_schema.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/mini_record/auto_schema.rb b/lib/mini_record/auto_schema.rb index cd8cdea..c6450e8 100644 --- a/lib/mini_record/auto_schema.rb +++ b/lib/mini_record/auto_schema.rb @@ -18,6 +18,9 @@ def init_table_definition(connection) when -5 # Rails 4.1 ActiveRecord::ConnectionAdapters::TableDefinition.new(connection.native_database_types, table_name, false, {}, nil) + when -4 + # Rails 5 + ActiveRecord::ConnectionAdapters::TableDefinition.new(table_name, false, {}, nil) else raise ArgumentError, "Unsupported number of args for ActiveRecord::ConnectionAdapters::TableDefinition.new()" From 33688e41cd66611f3b0c851521590b07022a1f49 Mon Sep 17 00:00:00 2001 From: Necros Date: Sat, 27 Aug 2016 14:45:43 +0300 Subject: [PATCH 2/3] Update according to the lastest Rails changes: https://github.com/rails/rails/blob/1a52ed178423dd727653c31398045993cd8c8cb8/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb#L212 --- lib/mini_record/auto_schema.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/mini_record/auto_schema.rb b/lib/mini_record/auto_schema.rb index c6450e8..a8372f2 100644 --- a/lib/mini_record/auto_schema.rb +++ b/lib/mini_record/auto_schema.rb @@ -1,4 +1,4 @@ -module MiniRecord +module MiniRecord module AutoSchema def self.included(base) base.extend(ClassMethods) @@ -19,8 +19,11 @@ def init_table_definition(connection) # Rails 4.1 ActiveRecord::ConnectionAdapters::TableDefinition.new(connection.native_database_types, table_name, false, {}, nil) when -4 - # Rails 5 + # Rails 5 beta ActiveRecord::ConnectionAdapters::TableDefinition.new(table_name, false, {}, nil) + when -2 + # Rails 5 + ActiveRecord::ConnectionAdapters::TableDefinition.new(table_name) else raise ArgumentError, "Unsupported number of args for ActiveRecord::ConnectionAdapters::TableDefinition.new()" From 2adf7e1abf7c07c6e200dc0354061aa0dcd70ea0 Mon Sep 17 00:00:00 2001 From: Necros Date: Sat, 27 Aug 2016 14:47:15 +0300 Subject: [PATCH 3/3] Remove BOM-symbol --- lib/mini_record/auto_schema.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mini_record/auto_schema.rb b/lib/mini_record/auto_schema.rb index a8372f2..9fd2612 100644 --- a/lib/mini_record/auto_schema.rb +++ b/lib/mini_record/auto_schema.rb @@ -1,4 +1,4 @@ -module MiniRecord +module MiniRecord module AutoSchema def self.included(base) base.extend(ClassMethods)