merit 2.3.3 → 2.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS.md +6 -0
- data/README.md +2 -2
- data/lib/merit.rb +2 -1
- data/lib/merit/controller_extensions.rb +16 -8
- data/merit.gemspec +1 -1
- data/test/dummy/app/models/merit/point_rules.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73bf41bfadf2e0f5a4c6ee7e6577d506f60b3eaf
|
4
|
+
data.tar.gz: 767294bcaf7a2b004db246471df0294f5fa16105
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14f72b0cd12dca5f0f02cbb120d8088e2a30b9648de4763f32e891c8ec4f23cd06fe32a1008bd012a28ecab94551152d4be4bd812d08c7b1a83ffa3578c90d7a
|
7
|
+
data.tar.gz: 33d894f57a5e03b57abf0ce647c100ceaed2364e86ba6a95e8bf8f224c469faaa3a5b29269f647069288781cb1a5064737ac8e7f72251182c014f2f69c371412
|
data/NEWS.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
User-visible changes worth mentioning.
|
4
4
|
|
5
|
+
## 2.3.4
|
6
|
+
|
7
|
+
- [#247] Fix Ruby warnings
|
8
|
+
- [#252] Bug fix: `uninitialized constant Merit::PointRules (NameError)` while
|
9
|
+
installing merit.
|
10
|
+
|
5
11
|
## 2.3.3
|
6
12
|
|
7
13
|
- [#215] Bug fix in API where a `BadgeSash` would be created without failures
|
data/README.md
CHANGED
@@ -89,8 +89,8 @@ Badge rules / conditions are defined in `app/models/merit/badge_rules.rb`
|
|
89
89
|
* Can be `:itself`, in which case it badges the target object itself
|
90
90
|
(`@model`).
|
91
91
|
* Is `:action_user` by default, which means `current_user`.
|
92
|
-
* `:model_name` define the
|
93
|
-
the
|
92
|
+
* `:model_name` define the model's name if it's different from
|
93
|
+
the controller's (e.g. the `User` model for the `RegistrationsController`).
|
94
94
|
* `:multiple` whether or not the badge may be granted multiple times. `false` by default.
|
95
95
|
* `:temporary` whether or not the badge should be revoked if the condition no
|
96
96
|
longer holds. `false` -badges are kept for ever- by default.
|
data/lib/merit.rb
CHANGED
@@ -90,7 +90,8 @@ module Merit
|
|
90
90
|
include Merit::ControllerExtensions
|
91
91
|
rescue NameError => e
|
92
92
|
# Trap NameError if installing/generating files
|
93
|
-
raise e unless
|
93
|
+
raise e unless
|
94
|
+
e.to_s =~ /uninitialized constant Merit::(BadgeRules|PointRules)/
|
94
95
|
end
|
95
96
|
end
|
96
97
|
end
|
@@ -47,15 +47,23 @@ module Merit
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def target_object
|
50
|
-
|
51
|
-
if
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
50
|
+
variable_name = :"@#{controller_name.singularize}"
|
51
|
+
if instance_variable_defined?(variable_name)
|
52
|
+
if target_obj = instance_variable_get(variable_name)
|
53
|
+
target_obj
|
54
|
+
else
|
55
|
+
warn_no_object_found
|
56
|
+
end
|
57
57
|
end
|
58
|
-
|
58
|
+
end
|
59
|
+
|
60
|
+
def warn_no_object_found
|
61
|
+
str = '[merit] No object found, you might need a ' \
|
62
|
+
"'@#{controller_name.singularize}' variable in " \
|
63
|
+
"'#{controller_path}_controller' if no reputation is applied. " \
|
64
|
+
'If you are using `model_name` option in the rule this is ok.'
|
65
|
+
Rails.logger.warn str
|
66
|
+
nil
|
59
67
|
end
|
60
68
|
|
61
69
|
def target_id
|
data/merit.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.files = `git ls-files`.split("\n").reject{|f| f =~ /^\./ }
|
7
7
|
s.test_files = `git ls-files -- test/*`.split("\n")
|
8
8
|
s.license = 'MIT'
|
9
|
-
s.version = '2.3.
|
9
|
+
s.version = '2.3.4'
|
10
10
|
s.authors = ["Tute Costa"]
|
11
11
|
s.email = 'tutecosta@gmail.com'
|
12
12
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: merit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tute Costa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ambry
|
@@ -281,7 +281,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
281
281
|
version: '0'
|
282
282
|
requirements: []
|
283
283
|
rubyforge_project:
|
284
|
-
rubygems_version: 2.
|
284
|
+
rubygems_version: 2.6.2
|
285
285
|
signing_key:
|
286
286
|
specification_version: 4
|
287
287
|
summary: Reputation engine for Rails apps
|