From efd6275e68225af88b78f70db40a0a1643cdf5a1 Mon Sep 17 00:00:00 2001 From: Raphael Sofaer Date: Tue, 5 Jul 2011 17:56:38 -0700 Subject: [PATCH] Don't instantiate objects in tag_string --- app/models/profile.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/models/profile.rb b/app/models/profile.rb index d45c29fbb..b7f497b43 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -112,7 +112,12 @@ class Profile < ActiveRecord::Base end def tag_string - @tag_string || self.tags.map{|t| '#' << t.to_s }.join(' ') + if @tag_string + @tag_string + else + rows = connection.select_rows( self.tags.scoped.to_sql ) + rows.inject(""){|string, row| string << "##{row[1]} " } + end end protected