On 06/23/11 - 12:43:40AM, Mo Morsi wrote:
---
src/app/models/instance.rb | 4 ++++
src/app/util/condormatic.rb | 33 +++++++++++++++++++++++++++++++++
2 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/src/app/models/instance.rb b/src/app/models/instance.rb
index 9c212d1..d32e820 100644
--- a/src/app/models/instance.rb
+++ b/src/app/models/instance.rb
@@ -130,6 +130,10 @@ class Instance < ActiveRecord::Base
before_destroy :destroyable?
+ def after_find
+ condormatic_instance_update(self)
+ end
A few things here:
1) From my very limited reading, after_find seems to get called for each
object in the list of found objects. Given our activerecord model, do we think
this is sufficient? That is, could it ever be the case that we need to find
by something like public_addresses, in which case this gets called too late?
2) How does this interact with solr/sunspot? It seems like what will happen
is that solr/sunspot can still do searches on the state field (for instance),
but they may find "stale" states. Can we make it so that we do an update of
that stuff before returning search results?
The parsing code below looks fine, so if we can resolve the above two I think
we will be OK.
--
Chris Lalancette