Skip to content

Commit

Permalink
Initialized options[:html] to {} if necessary before calling apply_fo…
Browse files Browse the repository at this point in the history
…rm_for_options! to play nice with Rails 3.1
  • Loading branch information
Nicholas Firth-McCoy committed Jun 14, 2011
1 parent 6a131fc commit 742bc94
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/better_form/view_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module BetterForm
module ViewHelper
def better_form_for(record_or_name_or_array, *args, &proc)
options = args.extract_options!.reverse_merge(:builder => BetterForm::Builder)
options[:html] ||= {}

# Call apply_form_for_options! here to have Rails set the class, id and method for the form as usual
# We need to call this here (rather than implicitly through the later form_for call) because
Expand All @@ -10,7 +11,6 @@ def better_form_for(record_or_name_or_array, *args, &proc)
apply_form_for_options!(record_or_name_or_array, options)

# Add the class 'better_form' to the list of classes for this form
options[:html] ||= {}
options[:html][:class] = "#{options[:html][:class]} better_form"

# Extract the better_form specific 'label' and 'validate_all' options
Expand Down

0 comments on commit 742bc94

Please sign in to comment.