Module: Forma::Helpers
- Defined in:
- lib/forma/helpers.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.forma_for(model, opts = {}) {|f| ... } ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/forma/helpers.rb', line 4 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| ... } ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/forma/helpers.rb', line 14 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 |
Instance Method Details
#table_for(models, opts = {}) {|t| ... } ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/forma/helpers.rb', line 22 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 |