forked from bofh/fetsite
Upgraded to Rails 4
This commit is contained in:
@@ -21,7 +21,7 @@ class Neuigkeit < ActiveRecord::Base
|
||||
has_many :nlinks, :dependent=> :destroy
|
||||
has_one :meeting
|
||||
has_many :attachments, :as=>:parent
|
||||
has_one :title_pic, :class_name=>"Attachment", :as=>:parent, :conditions=>["attachments.flag_titlepic =?", true]
|
||||
has_one :title_pic, -> {where("attachments.flag_titlepic =?", true)}, :class_name=>"Attachment", :as=>:parent
|
||||
|
||||
has_many :questions, :class_name=>"Survey::Question", as: :parent
|
||||
|
||||
@@ -32,11 +32,11 @@ class Neuigkeit < ActiveRecord::Base
|
||||
mount_uploader :picture, PictureUploader
|
||||
include IsCommentable
|
||||
|
||||
default_scope order(:cache_order).includes(:calentries).includes(:title_pic)
|
||||
default_scope { order(:cache_order).includes(:calentries).includes(:title_pic) }
|
||||
scope :recent, -> { published.limit(10)}
|
||||
scope :unpublished, -> {where("datum > ? OR datum IS NULL", Time.now)}
|
||||
scope :published_scope, ->{where("datum <= ? AND datum IS NOT NULL", Time.now)}
|
||||
scope :public, ->{includes(:rubrik).where("rubriken.public"=>true)}
|
||||
# scope :public, ->{includes(:rubrik).where("rubriken.public"=>true)}
|
||||
scope :intern, ->{includes(:rubrik).where("rubriken.public"=>false)}
|
||||
|
||||
# scope :search, ->(query) {where("text like ? or title like ?", "%#{query}%", "%#{query}%")}
|
||||
|
||||
Reference in New Issue
Block a user