Class: Hitchens::Post
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Hitchens::Post
- Defined in:
- app/models/hitchens/post.rb
Instance Method Summary collapse
Instance Method Details
#published ⇒ Object
13 14 15 16 |
# File 'app/models/hitchens/post.rb', line 13 def published return false unless publication_date publication_date < Time.now end |
#published=(value) ⇒ Object
6 7 8 9 10 11 12 |
# File 'app/models/hitchens/post.rb', line 6 def published=(value) if ActiveRecord::ConnectionAdapters::Column.value_to_boolean(value) self.publication_date = Time.now unless publication_date else self.publication_date = nil end end |