merit 0.9.0 → 0.9.1

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/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- merit (0.8.1)
4
+ merit (0.9.1)
5
5
  ambry (~> 0.3.0)
6
6
 
7
7
  GEM
@@ -35,7 +35,7 @@ GEM
35
35
  i18n (~> 0.6)
36
36
  multi_json (~> 1.0)
37
37
  addressable (2.2.7)
38
- ambry (0.3.0)
38
+ ambry (0.3.1)
39
39
  arel (3.0.2)
40
40
  bson (1.6.2)
41
41
  bson_ext (1.6.2)
data/README.md CHANGED
@@ -139,8 +139,6 @@ end
139
139
 
140
140
  # To-do list
141
141
 
142
- * Can infer params[:id] = instance_variable.id in create actions, for having
143
- the object in the rule method parameter, so we don't need it in controllers.
144
142
  * add an error handler for inexistent badges.
145
143
  * rails g merit MODEL_NAME shouldn't create general migrations again.
146
144
  * Abstract User (rule.rb#51 for instance) into a Merit option.
data/UPGRADING.md CHANGED
@@ -6,7 +6,7 @@ Adds `allow_multiple` boolean option to `Badge#grant_to` (defaults to
6
6
  `false`). If you used this method to grant a badge it will now grant only if
7
7
  resource doesn't have the badge.
8
8
 
9
- Use `grant_to resource, :allow_multiple => true` where needed.
9
+ Use `badge.grant_to resource, :allow_multiple => true` where needed.
10
10
 
11
11
  ## to 0.8.0
12
12
 
@@ -9,12 +9,13 @@ module Merit
9
9
  badge_rules = BadgeRules.new
10
10
  point_rules = PointRules.new
11
11
  if badge_rules.defined_rules[action].present? || point_rules.actions_to_point[action].present?
12
- target_id = params[:id]
13
12
  # TODO: target_object should be configurable (now it's singularized controller name)
14
13
  target_object = instance_variable_get(:"@#{controller_name.singularize}")
14
+ # Set target_id from params or from current instance variable
15
+ target_id = params[:id] || target_object.try(:id)
15
16
  # id nil, or string (friendly_id); target_object found
16
17
  if target_object.present? && (target_id.nil? || !(target_id =~ /^[0-9]+$/))
17
- target_id = target_object.try(:id)
18
+ target_id = target_object.id
18
19
  end
19
20
 
20
21
  # TODO: value should be configurable (now it's params[:value] set in the controller)
data/merit.gemspec CHANGED
@@ -4,7 +4,7 @@ Gem::Specification.new do |s|
4
4
  s.description = "Manage badges, points and rankings (reputation) of resources in a Rails application."
5
5
  s.homepage = "http://github.com/tute/merit"
6
6
  s.files = `git ls-files`.split("\n").reject{|f| f =~ /^\./ }
7
- s.version = "0.9.0"
7
+ s.version = "0.9.1"
8
8
  s.authors = ["Tute Costa"]
9
9
  s.email = 'tutecosta@gmail.com'
10
10
  s.add_dependency 'ambry', '~> 0.3.0'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: merit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: