Module: Mongoid::Publishable::InstanceMethods
- Defined in:
- lib/mongoid/publishable.rb
Instance Method Summary collapse
- #is_draft? ⇒ Boolean
- #is_published? ⇒ Boolean
- #is_scheduled? ⇒ Boolean
- #publish! ⇒ Object
- #schedule!(time) ⇒ Object
- #unpublish! ⇒ Object
Instance Method Details
#is_draft? ⇒ Boolean
34 35 36 37 |
# File 'lib/mongoid/publishable.rb', line 34 def is_draft? return true if self.published_at.nil? false end |
#is_published? ⇒ Boolean
29 30 31 32 |
# File 'lib/mongoid/publishable.rb', line 29 def is_published? return true if self.published_at && self.published_at <= Time.now false end |
#is_scheduled? ⇒ Boolean
24 25 26 27 |
# File 'lib/mongoid/publishable.rb', line 24 def is_scheduled? return true if self.published_at && self.published_at > Time.now false end |
#publish! ⇒ Object
43 44 45 |
# File 'lib/mongoid/publishable.rb', line 43 def publish! update_attributes(:published_at => Time.now) end |
#schedule!(time) ⇒ Object
39 40 41 |
# File 'lib/mongoid/publishable.rb', line 39 def schedule!(time) update_attributes(:published_at => time) end |
#unpublish! ⇒ Object
47 48 49 |
# File 'lib/mongoid/publishable.rb', line 47 def unpublish! update_attributes(:published_at => nil) end |