event_horizon 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/event_horizon.gemspec +1 -1
- data/lib/event_horizon/events.rb +7 -0
- data/lib/event_horizon/mongoid_support/event.rb +2 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.9
|
data/event_horizon.gemspec
CHANGED
data/lib/event_horizon/events.rb
CHANGED
@@ -31,6 +31,13 @@ module EventHorizon
|
|
31
31
|
|
32
32
|
module InstanceMethods
|
33
33
|
|
34
|
+
# Since Mongoid doesn't have polymorphic association support define
|
35
|
+
# events associations this way...
|
36
|
+
def events
|
37
|
+
type = self._type || self.class.name
|
38
|
+
Event.where(:document_id => self.id, :document_type => type)
|
39
|
+
end
|
40
|
+
|
34
41
|
def fire!(event, options = {})
|
35
42
|
self.call_event_callbacks_for(event)
|
36
43
|
self.create_event(event, options)
|
@@ -28,6 +28,8 @@ class Event
|
|
28
28
|
|
29
29
|
# Public methods
|
30
30
|
|
31
|
+
# Since Mongoid doesn't have polymorphic association support define
|
32
|
+
# events associations this way...
|
31
33
|
def document
|
32
34
|
self.document_type.constantize.find(self.document_id)
|
33
35
|
rescue ::Mongoid::Errors::DocumentNotFound
|