Sha256: afce98a737554fabcdf372580c249eab3975a3d7e35d4b21f6450ff323f3e86d

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

# Formize provides controller's side defined forms.
module Formize

  def self.configure(name, value = nil)
    unless self.respond_to?("#{name}=")
      mattr_accessor(name) 
      self.send("#{name}=", value)
    end
  end

  # default_source used by mono_choices:
  # - :foreign_class : Class of foreign object
  # - :class : Class of object
  # - "variable_name" or :variable_name : A variable (Class name is computed with the name
  #     of the variable. Example: "product" will have "Product" class_name. If class_name 
  #     has to be different, use next possibility.
  # - ["variable_name", "class_name"] : Code used to select source with the 
  #     class_name of the variable.
  configure :default_source, :foreign_class

  # How many radio can be displayed before to become a +select+
  configure :radio_count_max, 3

  # How many select options can be displayed before to become a +unroll+
  configure :select_count_max, 7

end

require 'action_view'
require 'formize/definition'
require 'formize/generator'
require 'formize/form_helper'
require 'formize/action_pack'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
formize-0.0.2 lib/formize.rb