Skip to content
Extraits de code Groupes Projets
Sélectionner une révision Git
  • 0bbdc1b979af52b7312cfd7fb58525358449390f
  • master par défaut protégée
2 résultats

track.rb

Blame
  • track.rb 625 o
    class Track < ActiveRecord::Base
      paginates_per 51  
      #default_scope includes(:channels,:users,:tags)
    
      has_many :irc_posts
      has_many :tag_assignations
    
      has_many :tags, through: :tag_assignations
      has_many :channels, through: :irc_posts
      has_many :users, through: :irc_posts
    
      def self.with_tag(tag)
        self.joins(:tags).where("tags.name = ?", tag )
        #self.includes(:tags)
        #self.where("tag = ?", tag)
      end
    
      def self.with_channel(channel)
        self.joins(:channels).where("channels.name = ?", "##{channel}")
      end
    
      def self.with_user(user)
        self.joins(:users).where("users.name = ?", user)
      end 
    
    end