diff options
| author | hukl <contact@smyck.org> | 2009-11-17 12:35:04 +0100 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-11-17 12:35:04 +0100 |
| commit | bc6080a332806c2d0d359e05aaee2a7865d08673 (patch) | |
| tree | 47e811f99c60a82d0dd6004b257d3a88a3d42652 /app/models/page.rb | |
| parent | c4b8b7f61d0c455aa77f72b96de4ba02ed03aa41 (diff) | |
don't set the published_at upon creation of the first draft but rather on publish
Diffstat (limited to 'app/models/page.rb')
| -rw-r--r-- | app/models/page.rb | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/app/models/page.rb b/app/models/page.rb index 22d2c69..00832bd 100644 --- a/app/models/page.rb +++ b/app/models/page.rb | |||
| @@ -36,13 +36,9 @@ class Page < ActiveRecord::Base | |||
| 36 | 36 | ||
| 37 | # Filter | 37 | # Filter |
| 38 | before_create :set_page_title | 38 | before_create :set_page_title |
| 39 | before_create :set_published_at | ||
| 40 | before_create :set_template | 39 | before_create :set_template |
| 41 | before_save :rewrite_links_in_body | 40 | before_save :rewrite_links_in_body |
| 42 | 41 | ||
| 43 | # Validations | ||
| 44 | validates_presence_of :published_at, :on => :update | ||
| 45 | |||
| 46 | # Security | 42 | # Security |
| 47 | attr_accessible :title, :abstract, :body, :template_name, :published_at, :user_id | 43 | attr_accessible :title, :abstract, :body, :template_name, :published_at, :user_id |
| 48 | 44 | ||
| @@ -201,12 +197,6 @@ class Page < ActiveRecord::Base | |||
| 201 | end | 197 | end |
| 202 | end | 198 | end |
| 203 | 199 | ||
| 204 | def set_published_at | ||
| 205 | if self.published_at.nil? | ||
| 206 | self.published_at = Time.now | ||
| 207 | end | ||
| 208 | end | ||
| 209 | |||
| 210 | def set_template | 200 | def set_template |
| 211 | if node && node.update? | 201 | if node && node.update? |
| 212 | self.template_name = "update" | 202 | self.template_name = "update" |
