track.rb
833 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
class OpenGraphPlugin::Track < ActiveRecord::Base
class_attribute :context
self.context = :open_graph
attr_accessible :type, :context, :tracker_id, :tracker, :actor_id, :action,
:object_type, :object_data_id, :object_data_type, :object_data_url,
:story, :object_data, :actor
belongs_to :tracker, class_name: 'Profile'
belongs_to :actor, class_name: 'Profile'
belongs_to :object_data, polymorphic: true
before_validation :set_context
def self.objects
[]
end
def self.association
@association ||= "open_graph_#{self.name.demodulize.pluralize.underscore}".to_sym
end
protected
def set_context
self[:context] = self.class.context
end
def print_debug msg
puts msg
Delayed::Worker.logger.debug msg
end
def debug? actor=nil
OpenGraphPlugin.debug? actor
end
end