module SimpleForm

Constants

CUSTOM_INPUT_DEPRECATION_WARN
VERSION

Public Class Methods

additional_classes_for(component) { |: []| ... } click to toggle source
# File lib/simple_form.rb, line 242
def self.additional_classes_for(component)
  generate_additional_classes_for.include?(component) ? yield : []
end
build(options = {}) { |builder| ... } click to toggle source

Builds a new wrapper using SimpleForm::Wrappers::Builder.

# File lib/simple_form.rb, line 221
def self.build(options = {})
  options[:tag] = :div if options[:tag].nil?
  builder = SimpleForm::Wrappers::Builder.new(options)
  yield builder
  SimpleForm::Wrappers::Root.new(builder.to_a, options)
end
default_input_size=(*) click to toggle source

SETUP

# File lib/simple_form.rb, line 248
def self.default_input_size=(*)
  ActiveSupport::Deprecation.warn "[SIMPLE_FORM] SimpleForm.default_input_size= is deprecated and has no effect", caller
end
eager_load!() click to toggle source
Calls superclass method
# File lib/simple_form.rb, line 21
def self.eager_load!
  super
  SimpleForm::Inputs.eager_load!
  SimpleForm::Components.eager_load!
end
setup() { |self| ... } click to toggle source

Default way to setup Simple Form. Run rails generate simple_form:install to create a fresh initializer with all configuration values.

# File lib/simple_form.rb, line 254
def self.setup
  @@configured = true
  yield self
end
wrapper(name) click to toggle source

Retrieves a given wrapper

# File lib/simple_form.rb, line 200
def self.wrapper(name)
  @@wrappers[name.to_s] or raise WrapperNotFound, "Couldn't find wrapper with name #{name}"
end
wrappers(*args, &block) click to toggle source

Define a new wrapper using SimpleForm::Wrappers::Builder and store it in the given name.

# File lib/simple_form.rb, line 210
def self.wrappers(*args, &block)
  if block_given?
    options                 = args.extract_options!
    name                    = args.first || :default
    @@wrappers[name.to_s]   = build(options, &block)
  else
    @@wrappers
  end
end