Skip to content

Instantly share code, notes, and snippets.

@captproton
Created October 7, 2013 20:16
Show Gist options
  • Select an option

  • Save captproton/6874213 to your computer and use it in GitHub Desktop.

Select an option

Save captproton/6874213 to your computer and use it in GitHub Desktop.
post.rb
class Post < ActiveRecord::Base
# validates :title, presence: true
# attr_accessible :title, :body, :image_url, :pubdate
attr_accessor :blog
def picture?
image_url.present?
end
def publish(clock=DateTime)
return false unless valid?
self.pubdate = clock.now
@blog.add_entry(self)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment