Module: Fume::Formtastic

Defined in:
lib/fume/formtastic.rb

Class Method Summary collapse

Class Method Details

.try_enableObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fume/formtastic.rb', line 4

def self.try_enable
  return unless defined? ::Formtastic
  
  ::Formtastic::SemanticFormBuilder.class_exec do
    alias_method :humanized_attribute_name_without_instance, :humanized_attribute_name
    
    def humanized_attribute_name(method)
      if @object && @object.respond_to?(:human_attribute_name)
        @object.human_attribute_name(method.to_s)
      else
        humanized_attribute_name_without_instance(method)
      end
    end
  end

end