Neugkeiten Verwalten..
This commit is contained in:
@@ -24,6 +24,8 @@ class Neuigkeit < ActiveRecord::Base
|
||||
mount_uploader :picture, PictureUploader
|
||||
scope :published, -> {where("datum <= ? AND datum IS NOT NULL", Time.now.to_date).order(:datum).reverse_order}
|
||||
scope :recent, -> { published.where("updated_at >= ? ",Time.now - 7.days)}
|
||||
scope :unpublished, -> {where("datum >= ? OR datum IS NULL", Date.today)}
|
||||
scope :public, ->{includes(:rubrik).where("rubriken.public"=>:true)}
|
||||
def datum_nilsave
|
||||
self.datum.nil? ? Time.now + 42.years : self.datum
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user