active_null 0.0.1 → 0.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: e79140a41af436782d71c91c0ddf040381e97da4
4
- data.tar.gz: 07bc97f09a1852ed98dfa86b97a0234bb8352f66
3
+ metadata.gz: 518cdc4de2b3392a5d7b75ed744d8831460d0ea1
4
+ data.tar.gz: de3700fb2a7533034b59fd40c57457aac7b939d8
5
5
  SHA512:
6
- metadata.gz: f78e90ca8b8555540005622d099edce35c10a6d0b409daeb7bc0a0b9507ffb62bebca6950ef1ee98ebcfcd781af3d7b8afc7d7c08b043e0ed13f330c602bd035
7
- data.tar.gz: 063645859d0cb859e2cf0f71bca659c6744d4117311ea38135680e07b999d0b39cd4bf354e1139d55f1e73fa2ce960ce9d120326014fcc098ec11ddb67fc2aa9
6
+ metadata.gz: 1b67ff883111566e2174fcbde438517228ced74adc77afe55c0ef2c55fe428c0cec18233c9576fb34861161d3a026637720c78c6178a6a5a5af73aaeb907da6f
7
+ data.tar.gz: f31fc682a1c014e8fc5e9f4f988ae07dcc662e5a6fdacb09ed0d93ed7e9d72fa810a359db068778378d86e7d4e152c96ce13235bc9436cc4916d059866869528
data/README.md CHANGED
@@ -46,7 +46,7 @@ You can now do things like this:
46
46
 
47
47
  ```ruby
48
48
  Post.null # => <null:Post>
49
- Post.null.comments # => []
49
+ Post.null.comments # => <ActiveRecord::Relation []>
50
50
  Comment.null # => <null:Comment>
51
51
  Comment.null.post # => <null:Post>
52
52
  Comment.new.post # => <null:Post>
@@ -17,7 +17,7 @@ module ActiveNull
17
17
 
18
18
  model.reflect_on_all_associations.each do |relation|
19
19
  if relation.collection?
20
- define_method(relation.name) { [] }
20
+ define_method(relation.name) { relation.klass.none }
21
21
  else
22
22
  define_method(relation.name) do
23
23
  return unless relation.klass.respond_to? :null
@@ -1,3 +1,3 @@
1
1
  module ActiveNull
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -11,6 +11,7 @@ describe ActiveNull do
11
11
 
12
12
  describe 'a has many' do
13
13
  specify { expect(Post.null.comments).to eq [] }
14
+ specify { expect(Post.null.comments).to be_instance_of(Comment::ActiveRecord_Relation) }
14
15
  end
15
16
 
16
17
  describe 'a belongs to' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_null
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - alexpeachey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-22 00:00:00.000000000 Z
11
+ date: 2014-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: naught