Diff
Modified: trunk/app/models/pack.rb (2703 => 2704)
--- trunk/app/models/pack.rb 2011-09-16 08:58:00 UTC (rev 2703)
+++ trunk/app/models/pack.rb 2011-09-16 12:34:59 UTC (rev 2704)
@@ -943,4 +943,9 @@
puts "id = #{id}, score = #{boost}"
boost
end
+
+ # touch method that mimics the simple use of the rails 2 touch method
+ def touch
+ update_attribute(:updated_at, Time.now)
+ end
end
Modified: trunk/app/models/pack_contributable_entry.rb (2703 => 2704)
--- trunk/app/models/pack_contributable_entry.rb 2011-09-16 08:58:00 UTC (rev 2703)
+++ trunk/app/models/pack_contributable_entry.rb 2011-09-16 12:34:59 UTC (rev 2704)
@@ -17,6 +17,9 @@
before_save :check_version
+ after_save :touch_pack
+ after_destroy :touch_pack
+
def check_unique
if self.contributable_version.blank?
i = PackContributableEntry.find(:first, :conditions => ["pack_id = ? AND contributable_type = ? AND contributable_id = ? AND contributable_version IS NULL", self.pack_id, self.contributable_type, self.contributable_id])
@@ -70,4 +73,8 @@
def item_as_list
return [contributable]
end
+
+ def touch_pack
+ pack.touch
+ end
end
Modified: trunk/app/models/pack_remote_entry.rb (2703 => 2704)
--- trunk/app/models/pack_remote_entry.rb 2011-09-16 08:58:00 UTC (rev 2703)
+++ trunk/app/models/pack_remote_entry.rb 2011-09-16 12:34:59 UTC (rev 2704)
@@ -14,6 +14,9 @@
validates_presence_of :user
before_create :check_unique
+
+ after_save :touch_pack
+ after_destroy :touch_pack
def check_unique
if PackRemoteEntry.find(:first, :conditions => ["pack_id = ? AND uri = ?", self.pack_id, self.uri])
@@ -23,4 +26,8 @@
return true
end
end
+
+ def touch_pack
+ pack.touch
+ end
end
Modified: trunk/app/models/relationship.rb (2703 => 2704)
--- trunk/app/models/relationship.rb 2011-09-16 08:58:00 UTC (rev 2703)
+++ trunk/app/models/relationship.rb 2011-09-16 12:34:59 UTC (rev 2704)
@@ -9,5 +9,11 @@
validates_uniqueness_of :predicate_id, :scope => [:subject_id, :objekt_id]
+ after_save :touch_context
+ after_destroy :touch_context
+
+ def touch_context
+ context.touch if context.respond_to?(:touch)
+ end
end