Changeset 1232

Show
Ignore:
Timestamp:
12/16/07 16:05:05 (1 year ago)
Author:
mikem836
Message:

aar :only option should allow use of symbols

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • acts_as_reportable/lib/ruport/acts_as_reportable.rb

    r1217 r1232  
    304304         
    305305        # Reorder columns to match options[:only] 
    306         self.class.aar_columns = options[:only] if Array === options[:only] 
     306        if Array === options[:only] 
     307          cols = options[:only].map {|c| c.to_s } 
     308          self.class.aar_columns = cols 
     309        end 
    307310         
    308311        self.class.aar_columns |= data_records.first.keys 
  • acts_as_reportable/test/acts_as_reportable_test.rb

    r1218 r1232  
    140140    end 
    141141       
     142    def test_only_option_allows_symbols 
     143      column_order = [:name, :personal_trainer_id, :team_id] 
     144      actual = Player.report_table(:all, :only => column_order) 
     145      expected = [["Player 1", 1, 1], 
     146        ["Player 2", 2, 1]].to_table(%w[name personal_trainer_id team_id]) 
     147      assert_equal expected, actual 
     148    end 
     149       
    142150    def test_except_option 
    143151      actual = Player.report_table(:all, :except => 'personal_trainer_id')