Joaquin Rivera Padron
2010-Aug-13 13:02 UTC
[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 method `form_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
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.