set nicer table name for report cache - reportable - Fork of reportable required by WarVox, from hdm/reportable.
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
       ---
 (DIR) commit a8fd0e703fd9b424cc69125c89722d85664bb5da
 (DIR) parent f757bffbf6e3107a81753511f9f7dbe25b7baca1
 (HTM) Author: Marco Otte-Witte <marco.otte-witte@simplabs.com>
       Date:   Wed, 29 Apr 2009 11:19:51 +0200
       
       set nicer table name for report cache
       
       Diffstat:
         M generators/reports_as_sparkline_mi… |      12 ++++++------
         M lib/simplabs/reports_as_sparkline/… |       2 ++
         M spec/db/schema.rb                   |       6 +++---
       
       3 files changed, 11 insertions(+), 9 deletions(-)
       ---
 (DIR) diff --git a/generators/reports_as_sparkline_migration/templates/migration.erb b/generators/reports_as_sparkline_migration/templates/migration.erb
       @@ -1,7 +1,7 @@
        class <%= class_name %> < ActiveRecord::Migration
        
          def self.up
       -    create_table :report_caches, :force => true do |t|
       +    create_table :reports_as_sparkline_cache, :force => true do |t|
              t.string   :model_name,       :null => false
              t.string   :report_name,      :null => false
              t.string   :grouping,         :null => false
       @@ -12,13 +12,13 @@ class <%= class_name %> < ActiveRecord::Migration
              t.timestamps
            end
        
       -    add_index :report_caches, [
       +    add_index :reports_as_sparkline_cache, [
              :model_name,
              :report_name,
              :grouping,
              :aggregation
            ], :name => :name_model_grouping_agregation
       -    add_index :report_caches, [
       +    add_index :reports_as_sparkline_cache, [
              :model_name,
              :report_name,
              :grouping,
       @@ -28,10 +28,10 @@ class <%= class_name %> < ActiveRecord::Migration
          end
        
          def self.down
       -    remove_index :report_caches, :name => :name_model_grouping_agregation
       -    remove_index :report_caches, :name => :name_model_grouping_aggregation_period
       +    remove_index :reports_as_sparkline_cache, :name => :name_model_grouping_agregation
       +    remove_index :reports_as_sparkline_cache, :name => :name_model_grouping_aggregation_period
        
       -    drop_table :report_caches
       +    drop_table :reports_as_sparkline_cache
          end
        
        end
 (DIR) diff --git a/lib/simplabs/reports_as_sparkline/report_cache.rb b/lib/simplabs/reports_as_sparkline/report_cache.rb
       @@ -4,6 +4,8 @@ module Simplabs #:nodoc:
        
            class ReportCache < ActiveRecord::Base #:nodoc:
        
       +      set_table_name :reports_as_sparkline_cache
       +
              def self.process(report, options, cache = true, &block)
                raise ArgumentError.new('A block must be given') unless block_given?
                self.transaction do
 (DIR) diff --git a/spec/db/schema.rb b/spec/db/schema.rb
       @@ -8,7 +8,7 @@ ActiveRecord::Schema.define(:version => 1) do
            t.timestamps
          end
        
       -  create_table :report_caches, :force => true do |t|
       +  create_table :reports_as_sparkline_cache, :force => true do |t|
            t.string   :model_name,       :null => false
            t.string   :report_name,      :null => false
            t.string   :grouping,         :null => false
       @@ -18,13 +18,13 @@ ActiveRecord::Schema.define(:version => 1) do
        
            t.timestamps
          end
       -  add_index :report_caches, [
       +  add_index :reports_as_sparkline_cache, [
            :model_name,
            :report_name,
            :grouping,
            :aggregation
          ], :name => :name_model_grouping_agregation
       -  add_index :report_caches, [
       +  add_index :reports_as_sparkline_cache, [
            :model_name,
            :report_name,
            :grouping,