Created
August 13, 2011 16:42
-
-
Save bradylove/1144019 to your computer and use it in GitHub Desktop.
Set published_at date if post is published
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def set_published_at | |
| if self.published == true and self.published_at.nil? == true | |
| self.published_at = Time.now | |
| elsif self.published == false | |
| self.published_at = nil | |
| elsif self.published == true and self.published_at.nil? == false | |
| self.published_at = published_at | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment