Module: Commenter::ControllerExtensions::InstanceMethods

Defined in:
lib/commenter/controller_extensions.rb

Instance Method Summary collapse

Instance Method Details

#container_idObject



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/commenter/controller_extensions.rb', line 18

def container_id
  @container_id ||= lambda{
    resource_type = self.class.to_s.underscore.split('_')[0].singularize
    if params[:container_id]
      params[:container_id]
    elsif params[:id]
      "#{resource_type}_#{params[:id]}"
    else
      raise "I don't know"
    end
  }.call
end

#render_with_responses(params = {}) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/commenter/controller_extensions.rb', line 31

def render_with_responses params={}
  if params.blank? and params[:format] == :js and @js_responses
    params[:layout] ||= "responses/#{params[:action]}"
    puts "Juggerbugger \n$\n$\n$\n$\n$\n$\n$\n$\n$\n$\n$"
  end
  render_without_responses params
end