Sha256: 8927039142101a285c98ec7544f2a4bdedc9a584854b7e7a0b58b22b94ec07e7
Contents?: true
Size: 627 Bytes
Versions: 7
Compression:
Stored size: 627 Bytes
Contents
# -*- encoding : utf-8 -*- # @author Anton Mezin module RailsConnector class Channel < AbstractModel self.primary_key = "channel_name" def self.table_name "#{table_name_prefix}" "channels" end has_many :news, :class_name => 'News', :foreign_key => 'channel_name' has_many :active_news, :class_name => 'News', :foreign_key => 'channel_name', :conditions => ['valid_from <= :now AND valid_until >= :now', {:now => Time.now.to_s(:number)}] has_many :objects, :through => :news def self.with_prefix(prefix) scoped.where(["channel_name LIKE ?", "#{prefix}%"]) end end end
Version data entries
7 entries across 7 versions & 1 rubygems