Sha256: b46c402d8c4338ba13b928cbbf1251b81f1cda8be066ef12b428977b18c43c38

Contents?: true

Size: 1.69 KB

Versions: 8

Compression:

Stored size: 1.69 KB

Contents

module Formtastic
  module Inputs
    module Base
      
      attr_accessor :builder, :template, :object, :object_name, :method, :options
      
      def initialize(builder, template, object, object_name, method, options)
        @builder = builder
        @template = template
        @object = object
        @object_name = object_name
        @method = method
        @options = options.dup
        
        warn_and_correct_option!(:label_method, :member_label)
        warn_and_correct_option!(:value_method, :member_value)
        warn_and_correct_option!(:group_label_method, :group_label)
      end
      
      def warn_and_correct_option!(old_option_name, new_option_name)
        if options.key?(old_option_name)
          ::ActiveSupport::Deprecation.warn("The :#{old_option_name} option is deprecated in favour of :#{new_option_name} and will be removed from Formtastic after 2.0")
          options[new_option_name] = options.delete(old_option_name)
        end
      end
      
      extend ActiveSupport::Autoload
      
      autoload :Associations
      autoload :Collections
      autoload :Choices
      autoload :Database
      autoload :Errors
      autoload :Fileish
      autoload :GroupedCollections
      autoload :Hints
      autoload :Html
      autoload :Labelling
      autoload :Naming
      autoload :Options
      autoload :Stringish
      autoload :Timeish
      autoload :Validations
      autoload :Wrapping
      
      include Html
      include Options
      include Database
      include Errors
      include Hints
      include Naming
      include Validations
      include Fileish
      include Associations
      include Labelling
      include Wrapping
      
    end
  end
end
  

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
formtastic-2.0.2 lib/formtastic/inputs/base.rb
formtastic-2.0.1 lib/formtastic/inputs/base.rb
formtastic-2.0.0 lib/formtastic/inputs/base.rb
formtastic-2.0.0.rc5 lib/formtastic/inputs/base.rb
formtastic-2.0.0.rc4 lib/formtastic/inputs/base.rb
formtastic-2.0.0.rc3 lib/formtastic/inputs/base.rb
formtastic-2.0.0.rc2 lib/formtastic/inputs/base.rb
formtastic-2.0.0.rc1 lib/formtastic/inputs/base.rb