Created
April 4, 2012 23:18
-
-
Save mickey/2306496 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Activity < ActiveRecord::Base | |
belongs_to :user | |
belongs_to :target, :polymorphic => true | |
default_scope :order => 'activities.created_at DESC', :limit => 10 | |
AUDITION_POSTED = 1 #target --> model audition | |
AUDITION_FEEDBACK_UPDATED = 2 #target --> model audition | |
AUDITION_VIEWED = 3 #target --> model video | |
NEW_PART = 4 #target --> model part | |
def self.add(user, activity_type, target) | |
return false if user.blank? or activity_type.blank? or target.blank? | |
activity = Activity.new(:user => user, :activity_type => activity_type, :target => target) | |
activity.save! | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment