public_activity 0.5.1.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/public_activity/common.rb +22 -6
- data/lib/public_activity/version.rb +1 -1
- metadata +2 -2
@@ -88,6 +88,7 @@ module PublicActivity
|
|
88
88
|
:recipient => options[:recipient],
|
89
89
|
:parameters => options[:params]
|
90
90
|
)
|
91
|
+
reset_activity_instance_options
|
91
92
|
end
|
92
93
|
end
|
93
94
|
|
@@ -106,12 +107,10 @@ module PublicActivity
|
|
106
107
|
# key
|
107
108
|
options = args.extract_options!
|
108
109
|
action = (args.first || options[:action]).try(:to_s)
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
key
|
113
|
-
self.activity_key ||
|
114
|
-
(self.class.name.parameterize('_') + "." + action.to_s)).to_s
|
110
|
+
|
111
|
+
key = extract_key(action, options)
|
112
|
+
|
113
|
+
raise NoKeyProvided, "No key provided for #{self.class.name}" unless key
|
115
114
|
|
116
115
|
# user responsible for the activity
|
117
116
|
owner = PublicActivity.resolve_value(self,
|
@@ -140,5 +139,22 @@ module PublicActivity
|
|
140
139
|
:params => params
|
141
140
|
}
|
142
141
|
end
|
142
|
+
|
143
|
+
def extract_key(action, options)
|
144
|
+
(options[:key] ||
|
145
|
+
self.activity_key ||
|
146
|
+
((self.class.name.underscore + "." + action.to_s) if action)).try(:to_s)
|
147
|
+
end
|
148
|
+
|
149
|
+
# Resets all instance options on the object
|
150
|
+
# triggered by a successful #create_activity, should not be
|
151
|
+
# called from any other place, or from application code.
|
152
|
+
# @private
|
153
|
+
def reset_activity_instance_options
|
154
|
+
@activity_params = {}
|
155
|
+
@activity_key = nil
|
156
|
+
@activity_owner = nil
|
157
|
+
@activity_recipient = nil
|
158
|
+
end
|
143
159
|
end
|
144
160
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: public_activity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-12-
|
13
|
+
date: 2012-12-22 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|