0
@@ -2,33 +2,37 @@ class Flag < ActiveRecord::Base
0
# serialize :flag, Symbol
0
belongs_to :flaggable, :polymorphic => true
0
+ # This is set dynamically in the plugin.
0
+ # define "can_flag" in your user/account model.
0
- # A user can flag a specific flaggable with a specific flag once
0
validates_presence_of :flag
0
+ # A user can flag a specific flaggable with a specific flag once
0
validates_uniqueness_of :user_id, :scope => [:flaggable_id, :flaggable_type, :flag]
0
- # Helper class method to lookup all flags assigned
0
- # to all flaggable types for a given user.
0
- def self.find_flags_by_user(user)
0
- :conditions => ["user_id = ?", user.id],
0
- :order => "created_at DESC"
0
- # Helper class method to look up all flags for
0
- # flaggable class name and flaggable id.
0
- def self.find_flags_for_flaggable(flaggable_str, flaggable_id)
0
- :conditions => ["flaggable_type = ? and flaggable_id = ?", flaggable_str, flaggable_id],
0
- :order => "created_at DESC"
0
- # Helper class method to look up a flaggable object
0
- # given the flaggable class name and id
0
- def self.find_flaggable(flaggable_str, flaggable_id)
0
- flaggable_str.constantize.find(flaggable_id)
0
+ # # Helper class method to lookup all flags assigned
0
+ # # to all flaggable types for a given user.
0
+ # def self.find_flags_by_user(user)
0
+ # :conditions => ["user_id = ?", user.id],
0
+ # :order => "created_at DESC"
0
+ # # Helper class method to look up all flags for
0
+ # # flaggable class name and flaggable id.
0
+ # def self.find_flags_for_flaggable(flaggable_str, flaggable_id)
0
+ # :conditions => ["flaggable_type = ? and flaggable_id = ?", flaggable_str, flaggable_id],
0
+ # :order => "created_at DESC"
0
+ # # Helper class method to look up a flaggable object
0
+ # # given the flaggable class name and id
0
+ # def self.find_flaggable(flaggable_str, flaggable_id)
0
+ # flaggable_str.constantize.find(flaggable_id)
0
\ No newline at end of file
Comments
No one has commented yet.