ActionView::Base.field_error_proc not called for FormBuilder#date_select #3487

Closed
v-yarotsky opened this Issue Nov 1, 2011 · 0 comments

Comments

Projects
None yet
2 participants
@v-yarotsky
Contributor

v-yarotsky commented Nov 1, 2011

See actionpack/lib/action_view/helpers/active_model_helper.rb, module ActiveModelInstanceTag. There is follwing code:

%w(content_tag to_date_select_tag to_datetime_select_tag to_time_select_tag).each do |meth|
  module_eval "def #{meth}(*) error_wrapping(super) end", __FILE__, __LINE__
end

those generated methods are never called, probably because ones defined in actionpack/lib/action_view/helpers/date_helper.rb redefine them.
The following monkey-patch in my application fixes the issue:

 class ActionView::Helpers::InstanceTag
   def to_date_select_tag_with_error_wrapping(*args)
      error_wrapping(to_date_select_tag_without_error_wrapping(*args))
   end
   alias_method_chain :to_date_select_tag, :error_wrapping  
end

Hovewer, it can not be treated as a solution.

Rails 3.0.9
ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin10.7.1], MBARI 0x6770, Ruby Enterprise Edition 2011.03

nashby added a commit to nashby/rails that referenced this issue Dec 19, 2011

@josevalim josevalim closed this in 9208813 Dec 20, 2011

josevalim added a commit that referenced this issue Dec 20, 2011

arunagw pushed a commit to arunagw/rails that referenced this issue Dec 20, 2011

Merge pull request #4064 from nashby/date-helper-field-error-proc
fix adding field_with_errors to date selects, closes #3487
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment