diff options
author | Gareth Rees <gareth@mysociety.org> | 2014-10-21 17:05:31 +0100 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2014-10-29 13:01:12 +0000 |
commit | be8daabd9e9b23239bd359e9dd1b38553ee3503d (patch) | |
tree | 44ed5ca706174ca33ab8e5f595004d0074b4653f | |
parent | 63752569c170334cfa81170c5b8b18cde293c77b (diff) |
Move User callbacks to top of file
Really difficult to figure out what’s going on when a callback is
buried halfway between a load of methods
-rw-r--r-- | app/models/user.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 4b83d8572..c6e2d2b47 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -62,6 +62,9 @@ class User < ActiveRecord::Base after_initialize :set_defaults + after_save :purge_in_cache + after_update :reindex_referencing_models + def created_at_numeric # format it here as no datetime support in Xapian's value ranges return self.created_at.strftime("%Y%m%d%H%M%S") @@ -72,7 +75,6 @@ class User < ActiveRecord::Base end # requested_by: and commented_by: search queries also need updating after save - after_update :reindex_referencing_models def reindex_referencing_models return if no_xapian_reindex == true @@ -439,7 +441,6 @@ class User < ActiveRecord::Base return true end - after_save(:purge_in_cache) def purge_in_cache if self.name_changed? self.info_requests.each {|x| x.purge_in_cache} |