Module: Wiserespond::ActionController

Defined in:
lib/wiserespond.rb

Instance Method Summary collapse

Instance Method Details

#respond_with_content(options = {}) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/wiserespond.rb', line 19

def respond_with_content(options={})
  options.reverse_merge!(
    :flash => nil,
    :status => :success,
    :locals => nil
  )
  
  self.setup_flash_for_content(options)
  
  respond_to do |format|
    format.html { render options[:action] }
    format.js { render :template => 'wiserespond/content', :locals => options }
  end
end

#respond_with_redirect(options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/wiserespond.rb', line 5

def respond_with_redirect(options={})
  options.reverse_merge!(
    :flash => nil,
    :status => :success
  )
  
  self.setup_flash_for_redirect(options)
  
  respond_to do |format|
    format.html { redirect_to options[:url] }
    format.js { render :template => 'wiserespond/redirect', :locals => options }        
  end
end