Don't instantiate objects in tag_string

This commit is contained in:
Raphael Sofaer 2011-07-05 17:56:38 -07:00
parent 0ac28cd9ea
commit efd6275e68

View file

@ -112,7 +112,12 @@ class Profile < ActiveRecord::Base
end end
def tag_string 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 end
protected protected