acts-as-joinable 0.1.5 → 0.1.6

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.
Files changed (3) hide show
  1. data/Rakefile +1 -1
  2. data/lib/acts_as_joinable/core.rb +4 -2
  3. metadata +4 -4
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'rake/gempackagetask'
5
5
  spec = Gem::Specification.new do |s|
6
6
  s.name = "acts-as-joinable"
7
7
  s.authors = ["Lance Pollard"]
8
- s.version = "0.1.5"
8
+ s.version = "0.1.6"
9
9
  s.summary = "ActsAsJoinable: DRYing up Many-to-Many Relationships in ActiveRecord"
10
10
  s.homepage = "http://github.com/viatropos/acts-as-joinable"
11
11
  s.email = "lancejpollard@gmail.com"
@@ -179,13 +179,15 @@ module ActsAsJoinable
179
179
  end
180
180
  define_method "#{singular_type}=" do |value|
181
181
  #send(relationship_with_context).delete_all
182
- send(plural_type) << value
182
+ unless value.blank?
183
+ send(plural_type) << value
184
+ end
183
185
  end
184
186
  define_method "#{singular_type}_id" do
185
187
  send(singular_type).id rescue nil
186
188
  end
187
189
  define_method "#{singular_type}_id=" do |id|
188
- send("#{singular_type}=", class_name.constantize.find(id))
190
+ send("#{singular_type}=", class_name.constantize.find_by_id(id))
189
191
  end
190
192
  end
191
193
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts-as-joinable
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 5
10
- version: 0.1.5
9
+ - 6
10
+ version: 0.1.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Lance Pollard
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-29 00:00:00 -05:00
18
+ date: 2010-09-30 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies: []
21
21