themessticker, cleanup routes

This commit is contained in:
2014-06-25 23:09:05 +05:30
parent 2ba920331a
commit ee8f2d0076
14 changed files with 208 additions and 263 deletions

View File

@@ -21,11 +21,12 @@ include Rails.application.routes.url_helpers
validates :themengruppe, :presence => true
validates :title, :presence => true
validates :text, :presence => true
scope :search, ->(query) {where("text like ? or title like ?", "%#{query}%", "%#{query}%")}
scope :outdated, -> {where("updated_at < ?", 1.week.ago)}
scope :outdated, -> {where("updated_at < ?", 2.month.ago)}
translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true
def is_outdated?
updated_at < 1.week.ago
updated_at < 1.month.ago
end
def is_wiki?
!(wikiname.nil? || wikiname.empty?)