Skip to content

Commit

Permalink
Merge remote branch 'mtarnovan/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
sobrinho committed Jul 21, 2010
2 parents 4036e74 + 0336197 commit fbd0a61
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions lib/formtastic.rb
Expand Up @@ -1724,9 +1724,7 @@ def escape_html_entities(string) #:nodoc:
module SemanticFormHelper
@@builder = ::Formtastic::SemanticFormBuilder
mattr_accessor :builder

@@default_field_error_proc = nil


# Override the default ActiveRecordHelper behaviour of wrapping the input.
# This gets taken care of semantically by adding an error class to the LI tag
# containing the input.
Expand All @@ -1736,13 +1734,13 @@ module SemanticFormHelper
end

def with_custom_field_error_proc(&block)
@@default_field_error_proc = ::ActionView::Base.field_error_proc
default_field_error_proc = ::ActionView::Base.field_error_proc
::ActionView::Base.field_error_proc = FIELD_ERROR_PROC
result = yield
::ActionView::Base.field_error_proc = @@default_field_error_proc
result
yield
ensure
::ActionView::Base.field_error_proc = default_field_error_proc
end

[:form_for, :fields_for, :remote_form_for].each do |meth|
module_eval <<-END_SRC, __FILE__, __LINE__ + 1
def semantic_#{meth}(record_or_name_or_array, *args, &proc)
Expand Down

0 comments on commit fbd0a61

Please sign in to comment.