提交 b9791d18 编写于 作者: R Ryuta Kamizono

Eliminate the duplicated `options_include_default?` method

Follow up 7ba2cd06.
上级 602ec7a4
......@@ -14,8 +14,10 @@ def accept(o)
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
......@@ -89,10 +91,6 @@ def add_column_options!(sql, options)
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"
......
......@@ -986,6 +986,10 @@ def add_index_options(table_name, column_name, options = {}) #:nodoc:
[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]
......@@ -1012,10 +1016,6 @@ def quoted_columns_for_index(column_names, options = {})
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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册