Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

properly memoize {field_type,select_type} as class variable

  • Loading branch information...
commit fcfe1fa87813bf85697c7a0db519e8ed9a483fc6 1 parent bf5f483
Akira Matsuda amatsuda authored committed
8 actionpack/lib/action_view/helpers/tags/date_select.rb
View
@@ -12,10 +12,16 @@ def render
error_wrapping(datetime_selector(@options, @html_options).send("select_#{select_type}").html_safe)
end
+ class << self
+ def select_type
+ @select_type ||= self.name.split("::").last.sub("Select", "").downcase
+ end
+ end
+
private
def select_type
- self.class.name.split("::").last.sub("Select", "").downcase
+ self.class.select_type
end
def datetime_selector(options, html_options)
8 actionpack/lib/action_view/helpers/tags/text_field.rb
View
@@ -13,10 +13,16 @@ def render
tag("input", options)
end
+ class << self
+ def field_type
+ @field_type ||= self.name.split("::").last.sub("Field", "").downcase
+ end
+ end
+
private
def field_type
- @field_type ||= self.class.name.split("::").last.sub("Field", "").downcase
+ self.class.field_type
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.