From 4f688b1362949f3e37af98c2e65084d27c3dc0a4 Mon Sep 17 00:00:00 2001 From: Tyler Hunt Date: Tue, 16 Oct 2012 17:17:47 -0700 Subject: [PATCH] Fix form helper for forms without a real record. --- lib/formulate/form_helper.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/formulate/form_helper.rb b/lib/formulate/form_helper.rb index 83c5800..b6bd425 100644 --- a/lib/formulate/form_helper.rb +++ b/lib/formulate/form_helper.rb @@ -4,9 +4,17 @@ module FormHelper def form_for(record, options={}, &proc) options[:html] ||= {} - apply_form_for_options!(record, options) + + case record + when String, Symbol + options[:html][:class] ||= '' + else + apply_form_for_options!(record, options) + end + options[:html][:class] << ' formulate' options[:html][:class] << " #{options[:class]}" if options[:class] + options[:html][:class].strip! original_field_error_proc = ::ActionView::Base.field_error_proc ::ActionView::Base.field_error_proc = FIELD_ERROR_PROC