class Cachai::Post

Public Class Methods

find_or_create_by_path(path) click to toggle source
# File lib/models.rb, line 105
def self.find_or_create_by_path(path)
  find_by_path(path) || create({:path => path})
end

Public Instance Methods

clear_cache() click to toggle source
# File lib/models.rb, line 121
def clear_cache
  Cachai.clear_cache(path)
end
comments_closed?(days_to_remain_open) click to toggle source
# File lib/models.rb, line 109
def comments_closed?(days_to_remain_open)
  return true if comments_allowed.to_i == 0

  return false if !days_to_remain_open

  # ok, we got an expiration period (seconds)
  # if we add it to the creation date and it's past
  # that date then yes, comments are closed.

  (created_at + days_to_remain_open) < Time.now
end