Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed fields_for helper #146

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/bh/core_ext/rails/form/fields_for_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ def fields_for(record_name, record_object = nil, fields_options = {}, &block)
record_object, fields_options = nil, record_object
end

fields_options[:layout] ||= @options[:layout]
fields_options[:errors] ||= @options[:errors]
fields_options[:layout] ||= @options[:layout] if @options.has_key?(:layout)
fields_options[:errors] ||= @options[:errors] if @options.has_key?(:errors)
title = fields_options.delete(:title) { record_name.to_s.humanize }
wrap_in_fieldset = fields_options.fetch :fieldset, true
fields = super record_name, record_object, fields_options, &block
wrap_in_fieldset ? fieldset(title) { fields } : fields
end
end
end
end
end