From 05d0d583cb03182e0d7c246c84e7f3ccd55a51a1 Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Tue, 12 Jun 2012 11:36:26 +0100 Subject: Return column name when iterating over admin fields. --- app/models/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/models/user.rb') diff --git a/app/models/user.rb b/app/models/user.rb index 57fce429c..573649b8f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -409,7 +409,7 @@ class User < ActiveRecord::Base columns = self.class.content_columns.map{|c| c if %w(created_at updated_at admin_level email_confirmed).include?(c.name) }.compact end columns.each do |column| - yield(column.human_name, self.send(column.name), column.type.to_s) + yield(column.human_name, self.send(column.name), column.type.to_s, column.name) end end -- cgit v1.2.3 From 08dac0261325cd757b7146f9626f3c7b48cc672c Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Wed, 20 Jun 2012 10:11:03 +0100 Subject: Only invalidate a user's cached requests when their *name* changes. Otherwise we issue PURGEs every time, for example, we send out email alerts. --- app/models/user.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'app/models/user.rb') diff --git a/app/models/user.rb b/app/models/user.rb index 573649b8f..a21676f68 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -438,8 +438,9 @@ class User < ActiveRecord::Base after_save(:purge_in_cache) def purge_in_cache - # XXX should only be if specific attributes have changed - self.info_requests.each {|x| x.purge_in_cache} + if self.name_changed? + self.info_requests.each {|x| x.purge_in_cache} + end end end -- cgit v1.2.3