From 6dfeafecb5507b321e005c855a52ea0584c30909 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Wed, 29 Oct 2014 13:22:18 +0100 Subject: [PATCH] nur public thmen wenn themengruppe public --- app/models/thema.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/thema.rb b/app/models/thema.rb index a12469e..9a426d1 100644 --- a/app/models/thema.rb +++ b/app/models/thema.rb @@ -21,7 +21,7 @@ include Rails.application.routes.url_helpers validates :themengruppe, :presence => true validates :title, :presence => true validates :text, :presence => true - scope :public, where(:isdraft=>false) + scope :public, where(:isdraft=>false).inlcudes(:themengruppe).where("themengruppen.public") default_scope order(:priority).reverse_order scope :search, ->(query) {where("text like ? or title like ?", "%#{query}%", "%#{query}%")} scope :outdated, -> {includes(:translations).where("thema_translations.updated_atI18n.t.locale)