Sha256: bcb37e6166a706e3594d3cd6fb5768851cc0cdba8d190c895da7c4066980de5d
Contents?: true
Size: 770 Bytes
Versions: 2
Compression:
Stored size: 770 Bytes
Contents
module BitPlayer class ContentModule < ActiveRecord::Base has_many :content_providers, class_name: 'BitPlayer::ContentProvider', foreign_key: :bit_player_content_module_id, inverse_of: :content_module validates :title, :context, :position, presence: true validates_numericality_of :position, greater_than_or_equal_to: 1 validates_uniqueness_of :position, scope: :context #def providers # ContentProvider.where(bit_player_content_module_id: id).order(:position) #end def provider(position) content_providers.where(position: position).first || BitPlayer::ContentProviders::Null.new(self) end def provider_exists?(position) content_providers.exists?(position: position) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bit_player-0.0.5 | app/models/bit_player/content_module.rb |
bit_player-0.0.4 | app/models/bit_player/content_module.rb |