Sha256: 6443790ba2fe2e2f4efb5a8e26a38048199fd2f4ba4b8f0ca3ce98ba31f827bc

Contents?: true

Size: 601 Bytes

Versions: 1

Compression:

Stored size: 601 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,
      lambda { 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

1 entries across 1 versions & 1 rubygems

Version Path
infopark_fiona_connector-7.0.1.5.2.3.rc4 lib/rails_connector/channel.rb