Class: ActionView::Helpers::InstanceTag
- Inherits:
-
Object
- Object
- ActionView::Helpers::InstanceTag
- Defined in:
- lib/form_fix.rb
Class Method Summary collapse
Class Method Details
.value(object, method_name) ⇒ Object
5 6 7 8 |
# File 'lib/form_fix.rb', line 5 def value(object, method_name) method_name += "_#{I18n.locale}" if I18n.locale != I18n.default_locale && object.class.columns.select {|c| c.name == "#{method_name}_#{I18n.locale}"}.length > 0 object.send method_name unless object.nil? end |
.value_before_type_cast(object, method_name) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/form_fix.rb', line 10 def value_before_type_cast(object, method_name) unless object.nil? method_name += "_#{I18n.locale}" if I18n.locale != I18n.default_locale && object.class.columns.select {|c| c.name == "#{method_name}_#{I18n.locale}"}.length > 0 return object.respond_to?(method_name + "_before_type_cast") ? object.send(method_name + "_before_type_cast") :object.send(method_name) end end |