Sha256: ed3660269726fc521f163cf42efa063fce0ad39965a7d850ba6e0e5c52c797dc
Contents?: true
Size: 595 Bytes
Versions: 11
Compression:
Stored size: 595 Bytes
Contents
module RailsConnector class Channel < CmsBaseModel self.primary_key = "channel_name" def self.table_name "#{table_name_prefix}" "channels" end has_many :news, class_name: "RailsConnector::News", foreign_key: "channel_name" has_many :active_news, -> { where(["valid_from <= :now AND valid_until >= :now", { now: Time.now.to_s(:number) }]) }, class_name: "RailsConnector::News", foreign_key: "channel_name" has_many :objects, through: :news scope :with_prefix, ->(prefix) { where(["channel_name LIKE ?", "#{prefix}%"]) } end end
Version data entries
11 entries across 11 versions & 1 rubygems