Module: HumpyardForm::ActionView::FormHelper

Defined in:
lib/humpyard_form/action_view/form_helper.rb

Instance Method Summary collapse

Instance Method Details

#humpyard_form_for(record, options = {}, &block) ⇒ Object



4
5
6
7
8
# File 'lib/humpyard_form/action_view/form_helper.rb', line 4

def humpyard_form_for(record, options={}, &block)
  form = HumpyardForm::FormBuilder.new(self, record, options)
  inner_haml = capture_haml(form, &block)
  render :partial => '/humpyard_form/form', :locals => {:form => form, :inner_haml => inner_haml}
end

#with_locale(locale) {|locale| ... } ⇒ Object

execute a block with a given locale

Yields:

  • (locale)


11
12
13
14
15
16
# File 'lib/humpyard_form/action_view/form_helper.rb', line 11

def with_locale(locale, &block)
  old_locale = I18n.locale
  I18n.locale = locale
  yield(locale)
  I18n.locale = old_locale
end