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

Version Path
infopark_fiona_connector-7.0.1.6.1.6.rc4 lib/rails_connector/channel.rb
infopark_fiona_connector-7.0.1.6.1.6.rc3 lib/rails_connector/channel.rb
infopark_fiona_connector-7.0.1.6.1.6.rc2 lib/rails_connector/channel.rb
infopark_fiona_connector-7.0.1.6.1.6.rc1 lib/rails_connector/channel.rb
infopark_fiona_connector-7.0.1.5.2.7.rc1 lib/rails_connector/channel.rb
infopark_fiona_connector-7.0.1.5.2.4.rc2 lib/rails_connector/channel.rb
infopark_fiona_connector-7.0.1.5.2.4.rc1 lib/rails_connector/channel.rb
infopark_fiona_connector-7.0.1.5.2.3.rc8 lib/rails_connector/channel.rb
infopark_fiona_connector-7.0.1.5.2.3.rc7 lib/rails_connector/channel.rb
infopark_fiona_connector-7.0.1.5.2.3.rc6 lib/rails_connector/channel.rb
infopark_fiona_connector-7.0.1.5.2.3.rc5 lib/rails_connector/channel.rb