Added scope to pages model
New scope to use when listing pages to show only the ones with current locale.
This commit is contained in:
@@ -9,6 +9,7 @@ class SiteCustomization::Page < ActiveRecord::Base
|
|||||||
|
|
||||||
scope :published, -> { where(status: 'published').order('id DESC') }
|
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_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
|
def url
|
||||||
"/#{slug}"
|
"/#{slug}"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<ul class="features">
|
<ul class="features">
|
||||||
<li><%= link_to t("pages.more_info.other.how_to_use", org_name: setting['org_name']), how_to_use_path %></li>
|
<li><%= link_to t("pages.more_info.other.how_to_use", org_name: setting['org_name']), how_to_use_path %></li>
|
||||||
|
|
||||||
<% SiteCustomization::Page.with_more_info_flag.each do |custom_page| %>
|
<% SiteCustomization::Page.with_more_info_flag.with_same_locale.each do |custom_page| %>
|
||||||
<li><%= link_to custom_page.title, page_path(custom_page.slug) %></li>
|
<li><%= link_to custom_page.title, page_path(custom_page.slug) %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
Reference in New Issue
Block a user