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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4dd0c165fcfb62ca39a5698738d617bbed6a29e8
4
- data.tar.gz: 1e4f6b5f4de2ac6c2bb2a0aa037c71e9dbdd692c
3
+ metadata.gz: ecc2d344c7bbdff842f92553d2a7a028f5a7c34e
4
+ data.tar.gz: 87136997ae1fccbffb70958662dc476fbb8a636c
5
5
  SHA512:
6
- metadata.gz: 01980d25e52b92204c22b1588ba3d704be0f1f9814f96401bde32bb3152b3910e06c11036df3fca9a10167233081f30f911bc4d371546dea9363307b36ab5217
7
- data.tar.gz: 0c10073d6a0d907ac594e76d55144aca04a15d4b709d535218e75f0795536b5886dcfe82cddc14fc0dd207d99ef49701bd85e0b6e7ee21836e1e8ceb025b3d2c
6
+ metadata.gz: 42685ddd2f09b51053c1547e76ba3a8470d308d34b2103d52c363b4a75bebcb529f878b7c1a25df5c3420f2454d6943a64af5845e5df510e7d9cb4badc986a8e
7
+ data.tar.gz: 18f01b95fb9602ca9e6f4c7fe1393094847ff8ae5f3441d4804b9c4eaf5409bd249d342821b68e794af2d4673e17a5f601c3282a0f4c7fa7b882bf191f1ac2f2
data/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
  [![Build Status](https://travis-ci.org/hzamani/active_record-acts_as.svg)](https://travis-ci.org/hzamani/active_record-acts_as)
3
3
  [![Code Climate](https://codeclimate.com/github/hzamani/active_record-acts_as.png)](https://codeclimate.com/github/hzamani/active_record-acts_as)
4
4
  [![Coverage Status](https://coveralls.io/repos/hzamani/active_record-acts_as/badge.png)](https://coveralls.io/r/hzamani/active_record-acts_as)
5
+ [![Dependency Status](https://gemnasium.com/hzamani/active_record-acts_as.svg)](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
- other.nil? || acting_as_reflection.name.to_s == other.to_s.underscore
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
@@ -1,6 +1,6 @@
1
1
 
2
2
  module ActiveRecord
3
3
  module ActsAs
4
- VERSION = "1.0.1"
4
+ VERSION = "1.0.2"
5
5
  end
6
6
  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.1
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-05 00:00:00.000000000 Z
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.2.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