Module: RPH::FormAssistant::ViewHelpers

Defined in:
lib/form_assistant/view_helpers.rb

Overview

methods that mix into ActionView::Base

Instance Method Summary collapse

Instance Method Details

#fieldset(legend, &block) ⇒ Object

(borrowed the #fieldset() helper from Chris Scharf:

http://github.com/scharfie/slate/tree/master/app/helpers/application_helper.rb)

<% fieldset ‘User Registration’ do %>

// fields

<% end %>



35
36
37
38
39
40
41
# File 'lib/form_assistant/view_helpers.rb', line 35

def fieldset(legend, &block)
  locals = { :legend => legend, :fields => capture(&block) }
  partial = render(:partial => "#{RPH::FormAssistant::FormBuilder.template_root}/fieldset.html.erb", :locals => locals)

  # render the fields
  binding_required ? concat(partial, block.binding) : concat(partial)
end

#form_assistant_for(record_or_name_or_array, *args, &proc) ⇒ Object

easy way to make use of FormAssistant::FormBuilder

<% form_assistant_for @project do |form| %>

// fancy form stuff

<% end %>



25
26
27
# File 'lib/form_assistant/view_helpers.rb', line 25

def form_assistant_for(record_or_name_or_array, *args, &proc)
  form_for_with_builder(record_or_name_or_array, RPH::FormAssistant::FormBuilder, *args, &proc)
end