merit 0.10.0 → 0.10.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.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- merit (0.10.0)
4
+ merit (0.10.1)
5
5
  ambry (~> 0.3.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -141,6 +141,7 @@ end
141
141
  (depends on params[:value] on the controller).
142
142
  * Make fixtures for integration testing (now creating objects on test file!).
143
143
  * Rules should be cached? Calling *Rules.new more than once
144
+ * Add badges_sashes timestamps
144
145
 
145
146
  ---
146
147
 
@@ -38,7 +38,7 @@ module Merit
38
38
  granted = log.split('|').select{|log| log =~ /badge_granted_to_action_user/ }
39
39
  granted.each do |badge|
40
40
  badge_id = badge.split(':').last.to_i
41
- flash[:merit] = t('merit.flashs.badge_granted', :badge => Badge.find(badge_id).name)
41
+ flash[:merit] = t('merit.flashs.badge_granted', :badge => t("badges.#{Badge.find(badge_id).name}.name"))
42
42
  end
43
43
  end
44
44
  end
@@ -3,7 +3,10 @@ module Merit
3
3
 
4
4
  module ClassMethods
5
5
  def has_merit(options = {})
6
- belongs_to :sash, :dependent => :destroy
6
+ # :dependent => destroy may raise
7
+ # ERROR: update or delete on table "sashes" violates foreign key constraint "users_sash_id_fk"
8
+ # https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1079-belongs_to-dependent-destroy-should-destroy-self-before-assocation
9
+ belongs_to :sash
7
10
 
8
11
  if Merit.orm == :mongo_mapper
9
12
  plugin Merit
@@ -16,6 +16,6 @@ class Sash < ActiveRecord::Base
16
16
  end
17
17
 
18
18
  def rm_badge(badge_id)
19
- badges_sashes.find_by_badge_id(badge_id).destroy
19
+ badges_sashes.find_by_badge_id(badge_id).try(:destroy)
20
20
  end
21
21
  end
@@ -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.10.0"
7
+ s.version = '0.10.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.10.0
4
+ version: 0.10.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-06 00:00:00.000000000 Z
12
+ date: 2012-09-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ambry