From 1ff4ece064039fce78953807583c5b5a1f1022f5 Mon Sep 17 00:00:00 2001 From: hukl Date: Mon, 9 Mar 2009 21:56:53 +0100 Subject: 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. --- app/models/page.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'app/models') 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 I18n.locale = locale_before end + def public? + published_at.nil? ? true : published_at < Time.now + end + private def rewrite_links_in_body -- cgit v1.3