lib/formtastic.rb
def method_required?(attribute) #:nodoc:
      if @object && @object.class.respond_to?(:reflect_on_validations_for)
        attribute_sym = attribute.to_s.sub(/_id$/, '').to_sym
        
        @object.class.reflect_on_validations_for(attribute_sym).any? do |validation|
          validation.macro == :validates_presence_of &&
          validation.name == attribute_sym &&
          (validation.options.present? ? (validation.options[:if] == true) : true)
        end
      else
        @@all_fields_required_by_default
      end
    end
# Determins if the attribute (eg :title) should be considered required or not.
#
# * if the :required option was provided in the options hash, the true/false value will be
#   returned immediately, allowing the view to override any guesswork that follows:
#
# * if the :required option isn't provided in the options hash, and the ValidationReflection
#   plugin is installed (http://github.com/redinger/validation_reflection), true is returned
#   if the validates_presence_of macro has been used in the class for this attribute, or false
#   otherwise.
#
# * if the :required option isn't provided, and the plugin isn't available, the value of the
#   configuration option @@all_fields_required_by_default is used.
#
Determins if the attribute  should be considered required or not.
if the :required option was provided in the options hash, the true/false value will be
returned immediately, allowing the view to override any guesswork that follows.

if the :required option isn't provided in the options hash, and the ValidationReflection
plugin is installed , true is returned
if the validates_presence_of macro has been used in the class for this attribute, or false
otherwise.

if the :required option isn't provided, and the plugin isn't available, the value of the
configuration option @@all_fields_required_by_default is used.
Determins if the attribute should be considered required or not . if the : required option was provided in the options hash the true / false value will be returned immediately allowing the view to override any guesswork that follows . if the : required option isn ' t provided in the options hash and the ValidationReflection plugin is installed true is returned if the validates_presence_of macro has been used in the class for this attribute or false otherwise . if the : required option isn ' t provided and the plugin isn ' t available the value of the configuration option @@all_fields_required_by_default is used .
def method_required?(attribute) 
      if @object && @object.class.respond_to?(:reflect_on_validations_for)
        attribute_sym = attribute.to_s.sub(/_id$/, '').to_sym
        @object.class.reflect_on_validations_for(attribute_sym).any? do |validation|
          validation.macro == :validates_presence_of &&
          validation.name == attribute_sym &&
          (validation.options.present? ? (validation.options[:if] == true) : true)
        end
      else
        @@all_fields_required_by_default
      end
    end
def method_required? ( attribute ) if @object && @object . class . respond_to? ( :reflect_on_validations_for ) attribute_sym = attribute . to_s . sub ( / _id$ / , '' ) . to_sym @object . class . reflect_on_validations_for ( attribute_sym ) . any? do | validation | validation . macro == :validates_presence_of && validation . name == attribute_sym && ( validation . options . present? ? ( validation . options [ :if ] == true ) : true ) end else @@all_fields_required_by_default end end
Determins if the attribute (eg :title) should be considered required or not.
Determins if the attribute ( eg : title ) should be considered required or not .
#:nodoc:
attribute