提交 abebdf52 编写于 作者: C Clemens Kofler 提交者: Jeremy Kemper

Use symbols for send and respond_to?.

Signed-off-by: NJeremy Kemper <jeremy@bitsweat.net>
上级 2e240f0e
...@@ -246,7 +246,7 @@ def to_tag(options = {}) ...@@ -246,7 +246,7 @@ def to_tag(options = {})
alias_method :tag_without_error_wrapping, :tag alias_method :tag_without_error_wrapping, :tag
def tag(name, options) def tag(name, options)
if object.respond_to?("errors") && object.errors.respond_to?("on") if object.respond_to?(:errors) && object.errors.respond_to?(:on)
error_wrapping(tag_without_error_wrapping(name, options), object.errors.on(@method_name)) error_wrapping(tag_without_error_wrapping(name, options), object.errors.on(@method_name))
else else
tag_without_error_wrapping(name, options) tag_without_error_wrapping(name, options)
...@@ -255,7 +255,7 @@ def tag(name, options) ...@@ -255,7 +255,7 @@ def tag(name, options)
alias_method :content_tag_without_error_wrapping, :content_tag alias_method :content_tag_without_error_wrapping, :content_tag
def content_tag(name, value, options) def content_tag(name, value, options)
if object.respond_to?("errors") && object.errors.respond_to?("on") if object.respond_to?(:errors) && object.errors.respond_to?(:on)
error_wrapping(content_tag_without_error_wrapping(name, value, options), object.errors.on(@method_name)) error_wrapping(content_tag_without_error_wrapping(name, value, options), object.errors.on(@method_name))
else else
content_tag_without_error_wrapping(name, value, options) content_tag_without_error_wrapping(name, value, options)
...@@ -264,7 +264,7 @@ def content_tag(name, value, options) ...@@ -264,7 +264,7 @@ def content_tag(name, value, options)
alias_method :to_date_select_tag_without_error_wrapping, :to_date_select_tag alias_method :to_date_select_tag_without_error_wrapping, :to_date_select_tag
def to_date_select_tag(options = {}, html_options = {}) def to_date_select_tag(options = {}, html_options = {})
if object.respond_to?("errors") && object.errors.respond_to?("on") if object.respond_to?(:errors) && object.errors.respond_to?(:on)
error_wrapping(to_date_select_tag_without_error_wrapping(options, html_options), object.errors.on(@method_name)) error_wrapping(to_date_select_tag_without_error_wrapping(options, html_options), object.errors.on(@method_name))
else else
to_date_select_tag_without_error_wrapping(options, html_options) to_date_select_tag_without_error_wrapping(options, html_options)
...@@ -273,7 +273,7 @@ def to_date_select_tag(options = {}, html_options = {}) ...@@ -273,7 +273,7 @@ def to_date_select_tag(options = {}, html_options = {})
alias_method :to_datetime_select_tag_without_error_wrapping, :to_datetime_select_tag alias_method :to_datetime_select_tag_without_error_wrapping, :to_datetime_select_tag
def to_datetime_select_tag(options = {}, html_options = {}) def to_datetime_select_tag(options = {}, html_options = {})
if object.respond_to?("errors") && object.errors.respond_to?("on") if object.respond_to?(:errors) && object.errors.respond_to?(:on)
error_wrapping(to_datetime_select_tag_without_error_wrapping(options, html_options), object.errors.on(@method_name)) error_wrapping(to_datetime_select_tag_without_error_wrapping(options, html_options), object.errors.on(@method_name))
else else
to_datetime_select_tag_without_error_wrapping(options, html_options) to_datetime_select_tag_without_error_wrapping(options, html_options)
...@@ -282,7 +282,7 @@ def to_datetime_select_tag(options = {}, html_options = {}) ...@@ -282,7 +282,7 @@ def to_datetime_select_tag(options = {}, html_options = {})
alias_method :to_time_select_tag_without_error_wrapping, :to_time_select_tag alias_method :to_time_select_tag_without_error_wrapping, :to_time_select_tag
def to_time_select_tag(options = {}, html_options = {}) def to_time_select_tag(options = {}, html_options = {})
if object.respond_to?("errors") && object.errors.respond_to?("on") if object.respond_to?(:errors) && object.errors.respond_to?(:on)
error_wrapping(to_time_select_tag_without_error_wrapping(options, html_options), object.errors.on(@method_name)) error_wrapping(to_time_select_tag_without_error_wrapping(options, html_options), object.errors.on(@method_name))
else else
to_time_select_tag_without_error_wrapping(options, html_options) to_time_select_tag_without_error_wrapping(options, html_options)
...@@ -298,7 +298,7 @@ def error_message ...@@ -298,7 +298,7 @@ def error_message
end end
def column_type def column_type
object.send("column_for_attribute", @method_name).type object.send(:column_for_attribute, @method_name).type
end end
end end
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册