fix public thema

This commit is contained in:
Andreas Stephanides
2014-10-29 13:44:17 +01:00
parent b0abb75d6b
commit 2855b72bb6

View File

@@ -21,9 +21,9 @@ include Rails.application.routes.url_helpers
validates :themengruppe, :presence => true validates :themengruppe, :presence => true
validates :title, :presence => true validates :title, :presence => true
validates :text, :presence => true validates :text, :presence => true
scope :public, where(:isdraft=>false).includes(:themengruppe).where("themengruppen.public") scope :public, where(:isdraft=>false).includes(:themengruppe).where("themengruppen.public"=>true)
default_scope order(:priority).reverse_order default_scope order("themen.priority").reverse_order
scope :search, ->(query) {where("text like ? or title like ?", "%#{query}%", "%#{query}%")} scope :search, ->(query) {where("themen.text like ? or themen.title like ?", "%#{query}%", "%#{query}%")}
scope :outdated, -> {includes(:translations).where("thema_translations.updated_at<?",2.month.ago).where("thema_translations.locale"=>I18n.t.locale) scope :outdated, -> {includes(:translations).where("thema_translations.updated_at<?",2.month.ago).where("thema_translations.locale"=>I18n.t.locale)
} }
translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true