module Formtastic::Inputs::Base::Naming
Public Instance Methods
as()
click to toggle source
# File lib/formtastic/inputs/base/naming.rb, line 6 def as self.class.name.split("::").last.underscore.gsub(/_input$/, '') end
attributized_method_name()
click to toggle source
# File lib/formtastic/inputs/base/naming.rb, line 18 def attributized_method_name method.to_s.gsub(/_id$/, '').to_sym end
humanized_method_name()
click to toggle source
# File lib/formtastic/inputs/base/naming.rb, line 22 def humanized_method_name if builder.label_str_method != :humanize # Special case where label_str_method should trump the human_attribute_name # TODO: is this actually a desired bheavior, or should we ditch label_str_method and # rely purely on :human_attribute_name. method.to_s.send(builder.label_str_method) elsif object && object.class.respond_to?(:human_attribute_name) object.class.human_attribute_name(method.to_s) else method.to_s.send(builder.label_str_method) end end
input_name()
click to toggle source
# File lib/formtastic/inputs/base/naming.rb, line 35 def input_name association_primary_key end
sanitized_method_name()
click to toggle source
# File lib/formtastic/inputs/base/naming.rb, line 14 def sanitized_method_name @sanitized_method_name ||= method.to_s.gsub(/[\?\/\-]$/, '') end
sanitized_object_name()
click to toggle source
# File lib/formtastic/inputs/base/naming.rb, line 10 def sanitized_object_name object_name.to_s.gsub(/\]\[|[^-a-zA-Z0-9:.]/, "_").sub(/_$/, "") end