active_record-acts_as 1.0.1 → 1.0.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 +4 -4
- data/README.md +1 -0
- data/lib/active_record/acts_as/relation.rb +8 -1
- data/lib/active_record/acts_as/version.rb +1 -1
- data/spec/acts_as_spec.rb +2 -0
- 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: ecc2d344c7bbdff842f92553d2a7a028f5a7c34e
|
4
|
+
data.tar.gz: 87136997ae1fccbffb70958662dc476fbb8a636c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42685ddd2f09b51053c1547e76ba3a8470d308d34b2103d52c363b4a75bebcb529f878b7c1a25df5c3420f2454d6943a64af5845e5df510e7d9cb4badc986a8e
|
7
|
+
data.tar.gz: 18f01b95fb9602ca9e6f4c7fe1393094847ff8ae5f3441d4804b9c4eaf5409bd249d342821b68e794af2d4673e17a5f601c3282a0f4c7fa7b882bf191f1ac2f2
|
data/README.md
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
[](https://travis-ci.org/hzamani/active_record-acts_as)
|
3
3
|
[](https://codeclimate.com/github/hzamani/active_record-acts_as)
|
4
4
|
[](https://coveralls.io/r/hzamani/active_record-acts_as)
|
5
|
+
[](https://gemnasium.com/hzamani/active_record-acts_as)
|
5
6
|
|
6
7
|
# ActiveRecord::ActsAs
|
7
8
|
|
@@ -25,7 +25,14 @@ module ActiveRecord
|
|
25
25
|
def acting_as?(other = nil)
|
26
26
|
if respond_to?(:acting_as_reflection) &&
|
27
27
|
acting_as_reflection.is_a?(ActiveRecord::Reflection::AssociationReflection)
|
28
|
-
|
28
|
+
case other
|
29
|
+
when Class
|
30
|
+
acting_as_reflection.class_name == other.to_s
|
31
|
+
when Symbol, String
|
32
|
+
acting_as_reflection.class_name.underscore == other.to_s
|
33
|
+
when NilClass
|
34
|
+
true
|
35
|
+
end
|
29
36
|
else
|
30
37
|
false
|
31
38
|
end
|
data/spec/acts_as_spec.rb
CHANGED
@@ -34,6 +34,7 @@ RSpec.describe "ActiveRecord::Base model with #acts_as called" do
|
|
34
34
|
it "returns true for supermodel class and name" do
|
35
35
|
expect(pen.acting_as? :product).to be true
|
36
36
|
expect(pen.acting_as? Product).to be true
|
37
|
+
expect(Inventory::PenLid.is_a? Inventory::ProductFeature).to be true
|
37
38
|
end
|
38
39
|
|
39
40
|
it "returns false for anything other than supermodel" do
|
@@ -47,6 +48,7 @@ RSpec.describe "ActiveRecord::Base model with #acts_as called" do
|
|
47
48
|
expect(Pen.is_a? Product).to be true
|
48
49
|
expect(Pen.is_a? Object).to be true
|
49
50
|
expect(Pen.is_a? String).to be false
|
51
|
+
expect(Inventory::PenLid.is_a? Inventory::ProductFeature).to be true
|
50
52
|
end
|
51
53
|
end
|
52
54
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record-acts_as
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hassan Zamani
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sqlite3
|
@@ -143,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
143
|
version: '0'
|
144
144
|
requirements: []
|
145
145
|
rubyforge_project:
|
146
|
-
rubygems_version: 2.
|
146
|
+
rubygems_version: 2.4.1
|
147
147
|
signing_key:
|
148
148
|
specification_version: 4
|
149
149
|
summary: Simulate multi-table inheritance for activerecord models
|