Class: ReputationSystem::Evaluation
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- ReputationSystem::Evaluation
- Defined in:
- lib/reputation_system/models/evaluation.rb
Class Method Summary collapse
- .create_evaluation(reputation_name, value, source, target) ⇒ Object
- .exists?(options = {}) ⇒ Boolean
- .find_by_reputation_name_and_source_and_target(reputation_name, source, target) ⇒ Object
- .original_exists? ⇒ Object
Class Method Details
.create_evaluation(reputation_name, value, source, target) ⇒ Object
45 46 47 48 49 |
# File 'lib/reputation_system/models/evaluation.rb', line 45 def self.create_evaluation(reputation_name, value, source, target) ReputationSystem::Evaluation.create!(:reputation_name => reputation_name.to_s, :value => value, :source_id => source.id, :source_type => source.class.name, :target_id => target.id, :target_type => target.class.name) end |
.exists?(options = {}) ⇒ Boolean
55 56 57 58 59 60 |
# File 'lib/reputation_system/models/evaluation.rb', line 55 def exists?(={}) if [:source_type] && [:target_type] && [:reputation_name] [:source_type] = get_source_type_for_sti([:source_type], [:target_type], [:reputation_name]) end original_exists? end |
.find_by_reputation_name_and_source_and_target(reputation_name, source, target) ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/reputation_system/models/evaluation.rb', line 34 def self.find_by_reputation_name_and_source_and_target(reputation_name, source, target) source_type = get_source_type_for_sti(source.class.name, target.class.name, reputation_name) ReputationSystem::Evaluation.where( :reputation_name => reputation_name.to_s, :source_id => source.id, :source_type => source_type, :target_id => target.id, :target_type => target.class.name ).first end |
.original_exists? ⇒ Object
53 |
# File 'lib/reputation_system/models/evaluation.rb', line 53 alias :original_exists? :exists? |