module RailsConnector # The CMS news object # # This class models the join table between channels and objects. # Instances of this class also hold information about validity range. # @api public class News < CmsBaseModel self.primary_key = "news_id" belongs_to :object, :class_name => 'Obj', :foreign_key => 'object_id' def self.table_name "#{table_name_prefix}" "news" end scope :active, -> { where('? BETWEEN valid_from AND valid_until', Time.now.to_s(:number))} scope :for_channel, ->(channel_name) {where(channel_name: channel_name)} end end