From 713f8f76e2ae1635bb938de6d8c74587d842790f Mon Sep 17 00:00:00 2001 From: hukl Date: Sat, 14 Nov 2009 13:51:27 +0100 Subject: Resolved issue of changing rss feed ids when changing the slugs of nodes Closes #35 --- app/models/node.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'app/models/node.rb') diff --git a/app/models/node.rb b/app/models/node.rb index 9bfea52..7e64fdd 100644 --- a/app/models/node.rb +++ b/app/models/node.rb @@ -165,6 +165,14 @@ class Node < ActiveRecord::Base head_id end + # Returns immutable node id for all new nodes so that the atom feed entry ids + # stay the same eventhough the slug or positions changes. + # Can be removed after a year or so ;) + def feed_id + new_id_format_date = "2009-11-14".to_time + self.created_at < new_id_format_date ? unique_path : id + end + protected def lock_for! current_user self.lock_owner = current_user -- cgit v1.3