riak-record 0.6.1 → 0.6.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: 9058471a2084e933c3282f8268fba62d96d5b75d
4
- data.tar.gz: 0ac7e0feec44f68e44da0158fe392151a19634ac
3
+ metadata.gz: 8285191a3c74c9168e390e57fad2f962d955b000
4
+ data.tar.gz: ee1a2c6137828311072a5d7935f8a72765951709
5
5
  SHA512:
6
- metadata.gz: 3aa0d524f82368db76422995dbad286ce37e318111663b2ff005426dcef4214253dc2991fdf824365756a6b5ffcc5d90892d90e9d5737a7e575967a0a0022f43
7
- data.tar.gz: 13b15afeb1d71a422e83233e20d00183f6c548478b0fe911f8512c4c8c67ae8623dc1c99a87639119b55f015755365b229093ff86c37bc36a1649e8369efb8fd
6
+ metadata.gz: 3e73ef5633ff909a9751fe768bdf0b5732284e1b7180c13b58f46463245d4cb6b3cb321e3e15a0a60452e5cd4f8482b954762b43b075a389350e0c5d61551b8c
7
+ data.tar.gz: 8b350e7afbc082ea3941ceaf1cc7b8c6be282448fa845e77519e2d1dac29cb06d81ff64ae193e1064c98dcc99b8d5e44133e7837f93d2244c2118bf97ca34e99
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.1
1
+ 0.6.2
@@ -37,7 +37,9 @@ module RiakRecord
37
37
 
38
38
  def #{association_name}
39
39
  @belongs_to_riak_#{association_name} = nil if @belongs_to_riak_#{association_name} && @belongs_to_riak_#{association_name}.id.to_s != Array(#{foreign_key}).first.to_s
40
- @belongs_to_riak_#{association_name} ||= #{class_name}.find(Array(#{foreign_key}).first)
40
+ related_id = Array(#{foreign_key}).first
41
+ @belongs_to_riak_#{association_name} ||= #{class_name}.find(related_id) if related_id
42
+ @belongs_to_riak_#{association_name}
41
43
  end
42
44
 
43
45
  def #{association_name}=(obj)
data/riak-record.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: riak-record 0.6.1 ruby lib
5
+ # stub: riak-record 0.6.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "riak-record"
9
- s.version = "0.6.1"
9
+ s.version = "0.6.2"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Robert Graff"]
14
- s.date = "2014-10-22"
14
+ s.date = "2014-10-23"
15
15
  s.description = "RiakRecord is a thin and immature wrapper around riak-ruby-client. It creates a bucket for\n each class, provides a simple finder, and creates attribute reader."
16
16
  s.email = "robert_graff@yahoo.com"
17
17
  s.extra_rdoc_files = [
@@ -52,6 +52,12 @@ describe RiakRecord::Associations do
52
52
  expect(post.author.name).to eq(@author.name)
53
53
  end
54
54
 
55
+ it "should not blow up when the relation is nil" do
56
+ expect{
57
+ Comment.new.linked_author
58
+ }.to_not raise_error
59
+ end
60
+
55
61
  it "should change the results when you change the foreign key value" do
56
62
  expect{
57
63
  post.author_id = @real_author.id
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riak-record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Graff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-22 00:00:00.000000000 Z
11
+ date: 2014-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: riak-client