diff options
| author | hukl <contact@smyck.org> | 2009-11-14 13:51:27 +0100 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-11-14 13:51:27 +0100 |
| commit | 713f8f76e2ae1635bb938de6d8c74587d842790f (patch) | |
| tree | a66a3418004ef511fc6987fe9852a2dd34c3835e /app/models | |
| parent | f671d3c3976c1b641fe2274668ecca82bf9b16cc (diff) | |
Resolved issue of changing rss feed ids when changing the slugs of nodes
Closes #35
Diffstat (limited to 'app/models')
| -rw-r--r-- | app/models/node.rb | 8 |
1 files changed, 8 insertions, 0 deletions
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 | |||
| 165 | head_id | 165 | head_id |
| 166 | end | 166 | end |
| 167 | 167 | ||
| 168 | # Returns immutable node id for all new nodes so that the atom feed entry ids | ||
| 169 | # stay the same eventhough the slug or positions changes. | ||
| 170 | # Can be removed after a year or so ;) | ||
| 171 | def feed_id | ||
| 172 | new_id_format_date = "2009-11-14".to_time | ||
| 173 | self.created_at < new_id_format_date ? unique_path : id | ||
| 174 | end | ||
| 175 | |||
| 168 | protected | 176 | protected |
| 169 | def lock_for! current_user | 177 | def lock_for! current_user |
| 170 | self.lock_owner = current_user | 178 | self.lock_owner = current_user |
