action-store 0.2.1 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: '09651bb0002d5efaf81354d1b4ba5b62d62576a4'
4
- data.tar.gz: 1d12ed61cdc42e0ff7d6c8d7fe9c63c09aee67bc
3
+ metadata.gz: c1b80762a43d47ccf77400612e0ec4840e1ab5f1
4
+ data.tar.gz: 3cb456ca8cfc16739c8fbb3cb1a1feb81691e5cc
5
5
  SHA512:
6
- metadata.gz: bbee1cd45d4e30fab4f567745a4f4001048d7975b204f6810cba737b18e2af82d35e1bb7d9adef4d8e4851260950b70971381ba4612a1e6128fa664d17f57b95
7
- data.tar.gz: c2fb0eca774924249021e6db24843643e49e9461c49fd717a1e2a862fabf4c3dfa0ab47f01d9c0bedf606905ea91ff844c93190316a79296680f4061556471b8
6
+ metadata.gz: 7de4c8111d3b7b92a14be4e041f079edce3dd011a81bcf2305f2c6fda7bf6ed8eeb8ad1173d25776a400458fbc9fdf1898ea7ed46b6bd8330cc0dcf673f78692
7
+ data.tar.gz: 34686b4ceea1480b6aba7708be7e0ebd6a0dd26680edf79d7b4c85883c990826584d8b2a28eb44255f83b093d8d89e747e3eec6cad81ee8129dcd2c11810c960
@@ -1,3 +1,12 @@
1
+ 0.2.2
2
+ -----
3
+
4
+ - Fix #2 support Target that under a namespace.
5
+
6
+ ```rb
7
+ action_store :like, :blog_post, class_name: 'Blog::Post'
8
+ ```
9
+
1
10
  0.2.1
2
11
  -----
3
12
 
@@ -23,10 +23,12 @@ module ActionStore
23
23
  module ClassMethods
24
24
  attr_reader :defined_actions
25
25
 
26
- def find_defined_action(action_type, name)
26
+ def find_defined_action(action_type, target_type)
27
27
  action_type = action_type.to_s
28
- name = name.to_s.singularize.underscore
29
- defined_actions.find { |a| a[:action_type] == action_type && a[:action_name] == name }
28
+ name = target_type.to_s.singularize.underscore
29
+ defined_actions.find do |a|
30
+ a[:action_type] == action_type && (a[:action_name] == name || a[:target_type] == target_type)
31
+ end
30
32
  end
31
33
 
32
34
  def action_store(action_type, name, opts = {})
@@ -48,6 +50,7 @@ module ActionStore
48
50
  action_name: name.to_s,
49
51
  action_type: action_type,
50
52
  target_klass: target_klass,
53
+ target_type: klass_name,
51
54
  counter_cache: opts[:counter_cache],
52
55
  user_counter_cache: opts[:user_counter_cache]
53
56
  }
@@ -212,4 +215,4 @@ module ActionStore
212
215
  end
213
216
  end
214
217
  end
215
- end
218
+ end
@@ -1,3 +1,3 @@
1
1
  module ActionStore
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action-store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Lee
@@ -37,7 +37,7 @@ executables: []
37
37
  extensions: []
38
38
  extra_rdoc_files: []
39
39
  files:
40
- - CHANGELOG
40
+ - CHANGELOG.md
41
41
  - LICENSE
42
42
  - README.md
43
43
  - Rakefile
@@ -71,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
71
  version: '0'
72
72
  requirements: []
73
73
  rubyforge_project:
74
- rubygems_version: 2.5.2
74
+ rubygems_version: 2.6.8
75
75
  signing_key:
76
76
  specification_version: 4
77
77
  summary: Store difference kind of actions (Like, Follow, Star, Block ...) in one table.