Module: RailsAjax::FormTagHelper

Included in:
ActionView::Base
Defined in:
lib/rails-ajax/form_tag_helper.rb

Overview

Module defining methods to include in ActionView::Helpers::FormTagHelper

Instance Method Summary collapse

Instance Method Details

#form_tag(url_for_options = {}, options = {}, &block) ⇒ Object

Replaces form_tag with an Ajax updated version



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/rails-ajax/form_tag_helper.rb', line 12

def form_tag(url_for_options = {}, options = {}, &block)
  if (RailsAjax.config.Enabled and
      RailsAjax::rails_ajaxifiable?(options))
    if block_given?
      return super(url_for_options, options.merge({ :remote => true, :'data-rails-ajax-remote' => true })) do
        block.call
      end
    else
      return super(url_for_options, options.merge({ :remote => true, :'data-rails-ajax-remote' => true }))
    end
  elsif block_given?
    return super(url_for_options, options) do
      block.call
    end
  else
    return super(url_for_options, options)
  end
end