Skip to content

Instantly share code, notes, and snippets.

@laurynas
Created November 15, 2010 21:20
Show Gist options
  • Save laurynas/700970 to your computer and use it in GitHub Desktop.
Save laurynas/700970 to your computer and use it in GitHub Desktop.
Add multi_locale_field helper to form builer
module FormBuilderHelper
def multi_locale_field(method, opts = {})
opts = {
:type => :text_field
}.merge(opts)
type = opts.delete(:type)
html = []
APP_CONFIG[:locales].each do |locale|
html << self.send(type, method, opts.merge(:locale => locale)) + ' ' + locale.to_s.upcase
end
html.join('<br />').html_safe!
end
end
ActionView::Helpers::FormBuilder.send(:include, FormBuilderHelper)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment