aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Daer <jeremydaer@gmail.com>2015-09-19 15:52:01 -0700
committerJeremy Daer <jeremydaer@gmail.com>2015-09-19 15:52:01 -0700
commit4726efa127a804f6d765b6268b3ff9e68f69f72d (patch)
treef17cf97ec7d5be040682e9f5348d7dff6a4096fa
parentfc7311d4f1f75a1a002e43e09cbed16d9d6e7caf (diff)
parentb9791d18da30dff98250f6753ea99cf93baad147 (diff)
downloadrails-4726efa127a804f6d765b6268b3ff9e68f69f72d.tar.gz
rails-4726efa127a804f6d765b6268b3ff9e68f69f72d.tar.bz2
rails-4726efa127a804f6d765b6268b3ff9e68f69f72d.zip
Merge pull request #21608 from kamipo/eliminate_duplicated_options_include_default_method
Eliminate the duplicated `options_include_default?` method
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb10
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb8
2 files changed, 8 insertions, 10 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb
index 236f577a38..09b2b892af 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb
@@ -14,8 +14,10 @@ module ActiveRecord
send m, o
end
- delegate :quote_column_name, :quote_table_name, :quote_default_expression, :type_to_sql, to: :@conn
- private :quote_column_name, :quote_table_name, :quote_default_expression, :type_to_sql
+ delegate :quote_column_name, :quote_table_name, :quote_default_expression, :type_to_sql,
+ :options_include_default?, to: :@conn
+ private :quote_column_name, :quote_table_name, :quote_default_expression, :type_to_sql,
+ :options_include_default?
private
@@ -96,10 +98,6 @@ module ActiveRecord
sql
end
- def options_include_default?(options)
- options.include?(:default) && !(options[:null] == false && options[:default].nil?)
- end
-
def action_sql(action, dependency)
case dependency
when :nullify then "ON #{action} SET NULL"
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
index 33a2afeba2..ef2616bf80 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
@@ -996,6 +996,10 @@ module ActiveRecord
[index_name, index_type, index_columns, index_options, algorithm, using]
end
+ def options_include_default?(options)
+ options.include?(:default) && !(options[:null] == false && options[:default].nil?)
+ end
+
protected
def add_index_sort_order(option_strings, column_names, options = {})
if options.is_a?(Hash) && order = options[:order]
@@ -1022,10 +1026,6 @@ module ActiveRecord
column_names.map {|name| quote_column_name(name) + option_strings[name]}
end
- def options_include_default?(options)
- options.include?(:default) && !(options[:null] == false && options[:default].nil?)
- end
-
def index_name_for_remove(table_name, options = {})
index_name = index_name(table_name, options)