<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -40,8 +40,11 @@ module Poormans
           type_cols    = @all_columns.select {|x| x =~ /(^type|_type)$/ }
           @columns = foreign_keys + type_cols
           @top_values = {}
+          @ass_lookup = {}
+          @ass_lookup['_total_'] = Proc.new { |i| 'Total' }
         
           @columns.each do |col|
+            @ass_lookup[col] = create_lookup(klass, col)
             @top_values[col] = klass.find(:all, {
               :select =&gt; &quot;COUNT(*) as #{col}_count, #{col}&quot;,
               :conditions =&gt; [&quot;FLOOR(DATEDIFF(NOW(), #{date_col}) / 7) &lt;= ?&quot;, @max_cols],
@@ -75,5 +78,19 @@ module Poormans
       @classname=params[:id]
       render :file =&gt; File.join(File.dirname(__FILE__), '..', 'views', 'error.html.erb')
     end
+
+    def create_lookup(klass, colname)
+      Proc.new do |i|
+        type = colname.gsub(/_id$/, '').to_sym
+        rel = klass.reflect_on_association(type)
+        if rel &amp;&amp; i
+          sym = rel.klass.respond_to?(:get_cache) ? :get_cache : :find
+          ob = rel.klass.send(sym, i)
+        else
+          i ? i : 'nil'
+        end
+      end
+    end
+
   end
 end
\ No newline at end of file</diff>
      <filename>lib/poormans_trends.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,7 @@
 &lt;div&gt;
   &lt;h1 style=&quot;margin-bottom: 0px; &quot;&gt;&lt;%= params[:id] %&gt;&lt;/h1&gt;
   &lt;h2 style=&quot;margin-top: 0px; &quot;&gt;&lt;%=h @all_columns.inspect %&gt;&lt;/h2&gt;
-  
+
   &lt;% @columns.each_with_index do |col, index| %&gt;
   &lt;table id=&quot;dataTable&lt;%= index %&gt;&quot; summary=&quot;&lt;%=h col %&gt;&quot;&gt;
   	&lt;caption&gt;&lt;%=h col %&gt;&lt;/caption&gt;
@@ -18,7 +18,7 @@
   	&lt;tbody&gt;
     &lt;% @top_values[col].each do |hash| %&gt;
       &lt;tr&gt;
-  			&lt;th headers=&quot;members&quot;&gt;&lt;%=h hash.keys.first || 'nil' %&gt;&lt;/th&gt;
+        &lt;th headers=&quot;members&quot;&gt;&lt;%= h(@ass_lookup[col].call(hash.keys.first)) %&gt;&lt;/th&gt;
   			&lt;% (0..@max_cols).to_a.reverse.each do |val| %&gt;
   			&lt;td headers=&quot;&lt;%= col %&gt;_&lt;%= val %&gt;&quot;&gt;&lt;%=h hash.values.first[val.to_s] || 0 %&gt;&lt;/td&gt;
   		  &lt;% end %&gt;</diff>
      <filename>views/table.html.erb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>e96eb8e3064b6da4905c0c695a2c5beb8066271a</id>
    </parent>
  </parents>
  <author>
    <name>Dustin Sallings</name>
    <email>dustin@caring.com</email>
  </author>
  <url>http://github.com/choonkeat/poormans-trends/commit/69942f696b597152a9f1db62b755fa13ebd57612</url>
  <id>69942f696b597152a9f1db62b755fa13ebd57612</id>
  <committed-date>2008-04-24T10:50:24-07:00</committed-date>
  <authored-date>2008-04-24T10:22:32-07:00</authored-date>
  <message>Lookup associations when building charts.</message>
  <tree>d0b690e2e4d20573d03e611f69a341e827cc8e53</tree>
  <committer>
    <name>Dustin Sallings</name>
    <email>dustin@spy.net</email>
  </committer>
</commit>
