module Formtastic::HtmlAttributes

@private

Public Instance Methods

dom_id_namespace() click to toggle source

Returns a namespace passed by option or inherited from parent builders / class configuration

# File lib/formtastic/html_attributes.rb, line 5
def dom_id_namespace
  namespace = options[:custom_namespace]
  parent = options[:parent_builder]

  case
    when namespace then namespace
    when parent && parent != self then parent.dom_id_namespace
    else custom_namespace
  end
end

Protected Instance Methods

humanized_attribute_name(method) click to toggle source
# File lib/formtastic/html_attributes.rb, line 18
def humanized_attribute_name(method)
  if @object && @object.class.respond_to?(:human_attribute_name)
    humanized_name = @object.class.human_attribute_name(method.to_s)
    if humanized_name == method.to_s.send(:humanize)
      method.to_s.send(label_str_method)
    else
      humanized_name
    end
  else
    method.to_s.send(label_str_method)
  end
end