lib/formtastic/helpers/input_helper.rb in formtastic-3.1.0 vs lib/formtastic/helpers/input_helper.rb in formtastic-3.1.1
- old
+ new
@@ -34,11 +34,11 @@
#
# @see #input
# @see Formtastic::Helpers::InputsHelper#inputs
# @see Formtastic::Helpers::FormHelper#semantic_form_for
module InputHelper
- INPUT_CLASS_DEPRECATION = 'configure Formtastic::FormBuilder.input_class_finder instead'.freeze
+ INPUT_CLASS_DEPRECATION = 'configure Formtastic::FormBuilder.input_class_finder instead (upgrade guide on wiki: http://bit.ly/1F9QtKc )'.freeze
private_constant(:INPUT_CLASS_DEPRECATION)
include Formtastic::Helpers::Reflection
include Formtastic::Helpers::FileColumnDetection
@@ -225,10 +225,11 @@
# user:
# email: "you@yours.com"
# first_name: "Joe"
# last_name: "Smith"
#
+ # @see #namespaced_input_class
# @todo Many many more examples. Some of the detail probably needs to be pushed out to the relevant methods too.
# @todo More i18n examples.
def input(method, options = {})
method = method.to_sym
options = options.dup # Allow options to be shared without being tainted by Formtastic
@@ -249,11 +250,11 @@
# cases it will simplify (like the case of :integer, :float & :decimal to :number), or do
# something different (like :password and :select).
#
# If there is no column for the method (eg "virtual columns" with an attr_accessor), the
# default is a :string, a similar behaviour to Rails' scaffolding.
- def default_input_type(method, options = {}) #:nodoc:
+ def default_input_type(method, options = {}) # @private
if @object
return :select if reflection_for(method)
return :file if is_file?(method, options)
end
@@ -293,11 +294,11 @@
return :string
end
end
# Get a column object for a specified attribute method - if possible.
- def column_for(method) #:nodoc:
+ def column_for(method) # @private
if @object.respond_to?(:column_for_attribute)
# Remove deprecation wrapper & review after Rails 5.0 ships
ActiveSupport::Deprecation.silence do
@object.column_for_attribute(method)
end
@@ -308,11 +309,11 @@
# class. In the case of `:as => :awesome` it will first attempt to find a
# top level `AwesomeInput` class (to allow the application to subclass
# and modify to suit), falling back to `Formtastic::Inputs::AwesomeInput`.
#
# Custom input namespaces to look into can be configured via the
- # .input_namespaces +FormBuilder+ configuration setting.
+ # {Formtastic::FormBuilder.input_namespaces} configuration setting.
#
# @param [Symbol] as A symbol representing the type of input to render
# @raise [Formtastic::UnknownInputError] An appropriate input class could not be found
# @return [Class] An input class constant
#
@@ -321,11 +322,11 @@
# input_class(:date) #=> Formtastic::Inputs::DateInput
#
# @example When a top-level class is found
# input_class(:string) #=> StringInput
# input_class(:awesome) #=> AwesomeInput
-
+ # @see NamespacedClassFinder#find
def namespaced_input_class(as)
@input_class_finder ||= input_class_finder.new(self)
@input_class_finder.find(as)
rescue Formtastic::InputClassFinder::NotFoundError
raise Formtastic::UnknownInputError, "Unable to find input #{$!.message}"
@@ -382,10 +383,10 @@
"#{as.to_s.camelize}Input"
end
# @api private
# @deprecated Use {InputClassFinder#class_name} instead.
- # :as => :string # => Formtastic::Inputs::StringInput
+ # :as => :string # => {Formtastic::Inputs::StringInput}
def standard_input_class_name(as)
input_class_deprecation_warning(__method__)
"Formtastic::Inputs::#{as.to_s.camelize}Input"
end