aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorAkira Matsuda <ronnie@dio.jp>2012-01-18 17:40:50 +0900
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-01-23 07:34:57 -0200
commitfcfe1fa87813bf85697c7a0db519e8ed9a483fc6 (patch)
tree95e2c5c6b0383d808dc42c3d6f8c3b144f33cd58 /actionpack
parentbf5f483cb25e648f437dc07adb072f2a10b11eb0 (diff)
downloadrails-fcfe1fa87813bf85697c7a0db519e8ed9a483fc6.tar.gz
rails-fcfe1fa87813bf85697c7a0db519e8ed9a483fc6.tar.bz2
rails-fcfe1fa87813bf85697c7a0db519e8ed9a483fc6.zip
properly memoize {field_type,select_type} as class variable
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_view/helpers/tags/date_select.rb8
-rw-r--r--actionpack/lib/action_view/helpers/tags/text_field.rb8
2 files changed, 14 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/helpers/tags/date_select.rb b/actionpack/lib/action_view/helpers/tags/date_select.rb
index 5912598ca1..5d706087b0 100644
--- a/actionpack/lib/action_view/helpers/tags/date_select.rb
+++ b/actionpack/lib/action_view/helpers/tags/date_select.rb
@@ -12,10 +12,16 @@ module ActionView
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)
diff --git a/actionpack/lib/action_view/helpers/tags/text_field.rb b/actionpack/lib/action_view/helpers/tags/text_field.rb
index 0f81726eb4..ce5182d20f 100644
--- a/actionpack/lib/action_view/helpers/tags/text_field.rb
+++ b/actionpack/lib/action_view/helpers/tags/text_field.rb
@@ -13,10 +13,16 @@ module ActionView
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