Skip to content

Instantly share code, notes, and snippets.

@bradylove
Created August 13, 2011 16:42
Show Gist options
  • Select an option

  • Save bradylove/1144019 to your computer and use it in GitHub Desktop.

Select an option

Save bradylove/1144019 to your computer and use it in GitHub Desktop.
Set published_at date if post is published
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