In Files

Files

Class/Module Index [+]

Quicksearch

SimpleForm

Constants

DEPRECATED

SETUP

VERSION

Public Class Methods

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

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

# File lib/simple_form.rb, line 164
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
deprecation_warn(message) click to toggle source
# File lib/simple_form.rb, line 205
def self.deprecation_warn(message)
  ActiveSupport::Deprecation.warn "[SIMPLE_FORM] #{message}", caller
end
setup() click to toggle source

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

# File lib/simple_form.rb, line 215
def self.setup
  yield self

  unless @@deprecated.empty?
    raise "[SIMPLE FORM] Your SimpleForm initializer file is using the following methods: #{@@deprecated.to_sentence}. " <<
      "Those methods are part of the outdated configuration API. Updating to the new API is easy and fast. " <<
      "Check for more info here: https://github.com/plataformatec/simple_form/wiki/Upgrading-to-Simple-Form-2.0"
  end
end
translate() click to toggle source
# File lib/simple_form.rb, line 200
def self.translate
  deprecation_warn "SimpleForm.translate is disabled in favor of translate_labels"
  self.translate_labels
end
translate=(value) click to toggle source
# File lib/simple_form.rb, line 195
def self.translate=(value)
  deprecation_warn "SimpleForm.translate= is disabled in favor of translate_labels="
  self.translate_labels = value
end
wrapper(name) click to toggle source

Retrieves a given wrapper

# File lib/simple_form.rb, line 143
def self.wrapper(name)
  @@wrappers[name.to_sym] 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 153
def self.wrappers(*args, &block)
  if block_given?
    options                 = args.extract_options!
    name                    = args.first || :default
    @@wrappers[name.to_sym] = build(options, &block)
  else
    @@wrappers
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.