From 1e3b1acbdd4b5275b871109a81b3062eec4c2875 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Fri, 25 Jan 2013 08:43:02 -0500 Subject: [PATCH] a tiny refactoring --- .../formtastic.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/formtastic-separate_html5_date_and_time/formtastic.rb b/lib/formtastic-separate_html5_date_and_time/formtastic.rb index 8c6ed09..0618f78 100644 --- a/lib/formtastic-separate_html5_date_and_time/formtastic.rb +++ b/lib/formtastic-separate_html5_date_and_time/formtastic.rb @@ -2,8 +2,8 @@ class SeparateDateAndTimePickerInput < Formtastic::Inputs::DatetimePickerInput def to_html input_wrapping do label_html << - builder.text_field("#{method}(date)", date_input_html_options) << - builder.text_field("#{method}(time)", time_input_html_options) + builder.text_field(date_method, date_input_html_options) << + builder.text_field(time_method, time_input_html_options) end end @@ -16,6 +16,14 @@ class SeparateDateAndTimePickerInput < Formtastic::Inputs::DatetimePickerInput { 'type' => 'time', 'value' => time_value } end + def date_method + "#{method}(date)" + end + + def time_method + "#{method}(time)" + end + def date_value value_parts.first end