initial commit
[acts_as_subscribeable.git] / lib / subscription.rb
blobc7cbb7fb564997b577700fe744df43adc580e56d
1 class Subscription < ActiveRecord::Base
2   belongs_to :subscribeable, :polymorphic => true
3   belongs_to :user
4   
5   # Helper class method to lookup all subscriptions assigned
6   # to all subscribeable types for a given user.
7   def self.find_subscriptions_by_user(user)
8     self.find(
9       :all,
10       :conditions => ["user_id = ?", user],
11       :order => "created_at DESC"
12     )
13   end
14   
15 end