module Forma::Helpers

Public Class Methods

forma_for(model, opts = {}) { |f| ... } click to toggle source
# File lib/forma/helpers.rb, line 3
def forma_for(model, opts = {})
  opts[:model] = model
  opts[:edit] = true
  opts[:auth_token] = form_authenticity_token if defined?(Rails)
  opts[:method] = 'post' if opts[:method].blank?
  f = Forma::Form.new(opts)
  yield f if block_given?
  f.to_html.to_s
end
view_for(model, opts = {}) { |f| ... } click to toggle source
# File lib/forma/helpers.rb, line 13
def view_for(model, opts = {})
  opts[:model] = model
  opts[:edit] = false
  f = Forma::Form.new(opts)
  yield f if block_given?
  f.to_html.to_s
end

Public Instance Methods

table_for(models, opts = {}) { |t)| ... } click to toggle source
# File lib/forma/helpers.rb, line 21
def table_for(models, opts = {}, &block)
  opts[:models] = models
  opts[:context] = block
  t = Forma::Table.new(opts)
  (yield t) if block_given?
  t.to_html.to_s
end

Private Instance Methods

forma_for(model, opts = {}) { |f| ... } click to toggle source
# File lib/forma/helpers.rb, line 3
def forma_for(model, opts = {})
  opts[:model] = model
  opts[:edit] = true
  opts[:auth_token] = form_authenticity_token if defined?(Rails)
  opts[:method] = 'post' if opts[:method].blank?
  f = Forma::Form.new(opts)
  yield f if block_given?
  f.to_html.to_s
end
view_for(model, opts = {}) { |f| ... } click to toggle source
# File lib/forma/helpers.rb, line 13
def view_for(model, opts = {})
  opts[:model] = model
  opts[:edit] = false
  f = Forma::Form.new(opts)
  yield f if block_given?
  f.to_html.to_s
end