query_report 0.0.9 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@ require 'query_report/report'
3
3
  module QueryReport
4
4
  module Helper
5
5
  def reporter(query, options={}, &block)
6
- @report ||= QueryReport::Report.new(params, options)
6
+ @report ||= QueryReport::Report.new(params, view_context, options)
7
7
  @report.query = query
8
8
  @report.instance_eval &block
9
9
  render_report
@@ -10,10 +10,11 @@ module QueryReport
10
10
  class Report
11
11
  include ActionView::Helpers
12
12
 
13
- attr_accessor :params, :chart, :charts, :filters, :scopes, :current_scope, :options
13
+ attr_accessor :params, :template, :chart, :charts, :filters, :scopes, :current_scope, :options
14
14
 
15
- def initialize(params, options={}, &block)
15
+ def initialize(params, template, options={}, &block)
16
16
  @params = params
17
+ @template = template
17
18
  @columns = []
18
19
  @filters = []
19
20
  @scopes = []
@@ -33,10 +34,18 @@ module QueryReport
33
34
 
34
35
  # to support the helper methods
35
36
  def method_missing(meth, *args, &block)
36
- if Rails.application.routes.url_helpers.respond_to?(meth)
37
- Rails.application.routes.url_helpers.send(meth, *args)
38
- elsif ActionController::Base.helpers.respond_to?(meth)
39
- ActionController::Base.helpers.send(meth, *args)
37
+ #if Rails.application.routes.url_helpers.respond_to?(meth)
38
+ # Rails.application.routes.url_helpers.send(meth, *args)
39
+ #elsif ActionController::Base.helpers.respond_to?(meth)
40
+ # ActionController::Base.helpers.send(meth, *args)
41
+ #else
42
+ # super # You *must* call super if you don't handle the
43
+ # # method, otherwise you'll mess up Ruby's method
44
+ # # lookup.
45
+ #end
46
+
47
+ if @template.respond_to?(meth)
48
+ @template.send(meth, *args)
40
49
  else
41
50
  super # You *must* call super if you don't handle the
42
51
  # method, otherwise you'll mess up Ruby's method
@@ -1,3 +1,3 @@
1
1
  module QueryReport
2
- VERSION = "0.0.9"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: query_report
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-30 00:00:00.000000000 Z
12
+ date: 2013-05-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ransack