Module: Confirmable::ConfirmsHelper

Defined in:
app/helpers/confirmable/confirms_helper.rb

Instance Method Summary collapse

Instance Method Details

#confirm_form_tag(&block) ⇒ Object

Raises:

  • (ArgumentError)


15
16
17
18
# File 'app/helpers/confirmable/confirms_helper.rb', line 15

def confirm_form_tag(&block)
  raise ArgumentError, "Missing block" unless block_given?
  form_tag("/"+params[:target_url], :method => params[:method].try(:to_sym), &block)
end


3
4
5
6
7
8
9
# File 'app/helpers/confirmable/confirms_helper.rb', line 3

def confirm_link_to(name, url_options, html_options={})
  @method = html_options.delete(:method) { |opt| 'post' }
  @confirm = html_options.delete(:confirm) #TODO: do something with the return value
  @target_url = url_for(url_options).slice(1..-1)

  link_to(name, confirm_url, html_options)
end

#confirm_urlObject



11
12
13
# File 'app/helpers/confirmable/confirms_helper.rb', line 11

def confirm_url
  confirmable.confirm_url(target_url: @target_url, method: @method)
end