Module: Globalize2::FormBuilderExtensions

Defined in:
lib/globalize2/form_builder_extensions.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
6
# File 'lib/globalize2/form_builder_extensions.rb', line 3

def self.included(base)    
  base.alias_method_chain :text_field, :globalize
  base.alias_method_chain :text_area,  :globalize
end

Instance Method Details

#text_area_with_globalize(method, options = {}) ⇒ Object



14
15
16
17
# File 'lib/globalize2/form_builder_extensions.rb', line 14

def text_area_with_globalize(method, options = {})
  options[:value] = options[:value] || I18n.with_locale(Globalize2Extension.content_locale) { object && object.send(method) }
  text_area_without_globalize(method, options)
end

#text_field_with_globalize(method, options = {}) ⇒ Object



8
9
10
11
12
# File 'lib/globalize2/form_builder_extensions.rb', line 8

def text_field_with_globalize(method, options = {})
  Rails.logger.debug "FormBuilder: text_field_with_globalize"
  options[:value] = options[:value] || I18n.with_locale(Globalize2Extension.content_locale) { object && object.send(method) }
  text_field_without_globalize(method, options)
end