forked from bofh/fetsite
Upgraded to Rails 4
This commit is contained in:
@@ -24,7 +24,7 @@ class Thema < ActiveRecord::Base
|
||||
# Attachments can be all data formats
|
||||
has_many :attachments, :as=>:parent
|
||||
# attached pics can be used as title pictures
|
||||
has_many :titlepics, :as=>:parent, :class_name=>'Attachment', :conditions=>{:flag_titlepic=>true}
|
||||
has_many :titlepics, -> {where(flag_titlepic: true)}, :as=>:parent, :class_name=>'Attachment'
|
||||
# each topic has to belong to one group
|
||||
belongs_to :themengruppe, :foreign_key => "themengruppe_id", :touch=>true
|
||||
validates :themengruppe, :presence => true
|
||||
@@ -41,9 +41,9 @@ class Thema < ActiveRecord::Base
|
||||
validates :text, :presence => true
|
||||
|
||||
scope :outdated, -> {includes(:translations).where("thema_translations.updated_at<?",7.month.ago).where("thema_translations.locale"=>I18n.locale)}
|
||||
scope :public, where(:isdraft=>false).includes(:themengruppe).where("themengruppen.public"=>true)
|
||||
scope :published,->{ where(:isdraft=>false).includes(:themengruppe).where("themengruppen.public"=>true)}
|
||||
|
||||
default_scope includes(:translations).order("themen.priority").reverse_order
|
||||
default_scope -> {includes(:translations).order("themen.priority").reverse_order}
|
||||
# make topic searchable
|
||||
searchable do
|
||||
text :text
|
||||
|
||||
Reference in New Issue
Block a user