From ed7b7f0361ce6eaa900edf8f5e08241a19ba7313 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Checa?= Date: Sun, 2 Jul 2017 14:54:11 +0200 Subject: [PATCH] Added scope to pages model New scope to use when listing pages to show only the ones with current locale. --- app/models/site_customization/page.rb | 1 + app/views/pages/more_info/_other.html.erb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/site_customization/page.rb b/app/models/site_customization/page.rb index c2a9b1467..d064187c1 100644 --- a/app/models/site_customization/page.rb +++ b/app/models/site_customization/page.rb @@ -9,6 +9,7 @@ class SiteCustomization::Page < ActiveRecord::Base scope :published, -> { where(status: 'published').order('id DESC') } scope :with_more_info_flag, -> { where(status: 'published', more_info_flag: true).order('id ASC') } + scope :with_same_locale, -> { where(locale: I18n.locale).order('id ASC') } def url "/#{slug}" diff --git a/app/views/pages/more_info/_other.html.erb b/app/views/pages/more_info/_other.html.erb index c33f17fd6..5ed1b9f4e 100644 --- a/app/views/pages/more_info/_other.html.erb +++ b/app/views/pages/more_info/_other.html.erb @@ -3,7 +3,7 @@