From fcfe1fa87813bf85697c7a0db519e8ed9a483fc6 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Wed, 18 Jan 2012 17:40:50 +0900 Subject: properly memoize {field_type,select_type} as class variable --- actionpack/lib/action_view/helpers/tags/text_field.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'actionpack/lib/action_view/helpers/tags/text_field.rb') 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 -- cgit v1.2.3