diff options
| author | hukl <contact@smyck.org> | 2009-03-09 21:56:53 +0100 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-03-09 21:56:53 +0100 |
| commit | 1ff4ece064039fce78953807583c5b5a1f1022f5 (patch) | |
| tree | b5fe2e7077ef0d91e6072f17f61ad5e9e47e0dbb /app/models | |
| parent | 55bc7e53f260bda99fd007d3422b264e1f4f6124 (diff) | |
only render pages if their published_at date is either nil or set to a time < Time.now. The render_page method will render a 404 otherwise.
Diffstat (limited to 'app/models')
| -rw-r--r-- | app/models/page.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/page.rb b/app/models/page.rb index ae2f998..af820e3 100644 --- a/app/models/page.rb +++ b/app/models/page.rb | |||
| @@ -109,6 +109,10 @@ class Page < ActiveRecord::Base | |||
| 109 | I18n.locale = locale_before | 109 | I18n.locale = locale_before |
| 110 | end | 110 | end |
| 111 | 111 | ||
| 112 | def public? | ||
| 113 | published_at.nil? ? true : published_at < Time.now | ||
| 114 | end | ||
| 115 | |||
| 112 | private | 116 | private |
| 113 | 117 | ||
| 114 | def rewrite_links_in_body | 118 | def rewrite_links_in_body |
