[rails3.0.0.beta4] extend form_tag to always include a hidden field

hi there,
I want every form in the site to add a hidden_field, basically I want
them
to always submit the I18n.locale, I’ve tried to alias form_tag_html
method
of ActionView::Helpers::FormTagHelper like this:

in #{MY_APP_ROOT}/lib/action_view/helpers/form_tag_helper.rb

module ActionView::Helpers::FormTagHelper

def form_tag_html_with_locale(html_options)
form = form_tag_html_without_locale(html_options)
form.safe_contact(hidden_field_tag(‘locale’, I18n.locale))
end
alias_method_chain :form_tag_html, :locale

end

but I get this exception:

in alias_method': undefined methodform_tag_html’ for module
`ActionView::Helpers::FormTagHelper’ (NameError)

am I missing something, is this a good approach for this? (I mean
since form_tag_html is a private method, for instance)

what’s your opinion? any ideas? TIA
joaquin


www.least-significant-bit.com

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs