Module: GoogleDataSource::Reporting::ActionControllerExtension

Defined in:
lib/reporting/action_controller_extension.rb

Instance Method Summary collapse

Instance Method Details

#render_with_reporting(*args) ⇒ Object

Add the option :reporting to the render method. Takes a Reporting object and renders the data-source response including the form validation results



7
8
9
10
11
12
13
14
15
16
# File 'lib/reporting/action_controller_extension.rb', line 7

def render_with_reporting(*args)
  if !args.first.nil? && args.first.is_a?(Hash) && args.first.has_key?(:reporting)
    reporting = args.first[:reporting]
    datasource = GoogleDataSource::DataSource::Base.from_params(params)
    datasource.set(reporting)
    render_for_text datasource.response
  else
    render_without_reporting(*args)
  end
end