lib/mongoid/report.rb in mongoid-report-0.0.9 vs lib/mongoid/report.rb in mongoid-report-0.0.10
- old
+ new
@@ -4,10 +4,11 @@
require_relative 'report/queries_builder'
require_relative 'report/attach_proxy'
require_relative 'report/collection'
require_relative 'report/scope'
require_relative 'report/scope_collection'
+require_relative 'report/report_proxy'
module Mongoid
module Report
extend ActiveSupport::Concern
@@ -63,9 +64,14 @@
define_report_method(*fields) do |columns, report_name|
columns.each do |column|
add_field(report_name, column)
end
end
+ end
+
+ def report(name, &block)
+ proxy = ReportProxy.new(self, name)
+ proxy.instance_eval(&block)
end
def fields(collection)
settings_property(collection, :fields)
end