diff options
author | Dries Steenhouwer <steenhouwer.dries@gmail.com> | 2013-11-29 12:10:00 +0100 |
---|---|---|
committer | Dries Steenhouwer <steenhouwer.dries@gmail.com> | 2013-11-29 12:10:00 +0100 |
commit | d769f21dcbb5337d56b6d980a00d70a3e8e007c8 (patch) | |
tree | e216db00e98e4ae5eeff780e0c032ec0fbf9bc3c /app/models | |
parent | 9944242e3486586f397ad4353c32c411b7ef670b (diff) | |
download | refinerycms-pc_banners-d769f21dcbb5337d56b6d980a00d70a3e8e007c8.tar.gz refinerycms-pc_banners-d769f21dcbb5337d56b6d980a00d70a3e8e007c8.tar.bz2 refinerycms-pc_banners-d769f21dcbb5337d56b6d980a00d70a3e8e007c8.zip |
add language support to banners
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/refinery/banners/banner.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/app/models/refinery/banners/banner.rb b/app/models/refinery/banners/banner.rb index 16aa8fd..1a43fa7 100644 --- a/app/models/refinery/banners/banner.rb +++ b/app/models/refinery/banners/banner.rb @@ -7,7 +7,7 @@ module Refinery acts_as_indexed :fields => [:name, :url, :title, :description] - attr_accessible :name, :title, :description, :image_id, :url, :is_active, :start_date, :expiry_date, :position, :page_ids + attr_accessible :name, :title, :description, :image_id, :url, :is_active, :start_date, :expiry_date, :position, :page_ids, :locale validates :name, :presence => true validates_presence_of :start_date @@ -25,6 +25,9 @@ module Refinery scope :published, lambda { not_expired.active.where("start_date <= ?", Time.now).order(:position) } + scope :publish_in_current_locale, lambda{ + not_expired.active.where("start_date <= ?", Time.now).where("locale = ? or locale = ''", ::I18n.locale) + } end end |