prim 0.0.7 → 0.0.8
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.
- data/lib/prim/collection.rb +3 -0
- data/prim.gemspec +1 -1
- metadata +1 -1
data/lib/prim/collection.rb
CHANGED
|
@@ -28,6 +28,9 @@ module Prim
|
|
|
28
28
|
# Sets the primary member of this collection. Requires a `source_record` to
|
|
29
29
|
# be passed (i.e. a Tag if Post `has_many :tags, through: :taggings`).
|
|
30
30
|
def primary= source_record
|
|
31
|
+
# Ensure what's passed can be set as the primary.
|
|
32
|
+
return true unless source_record.is_a? relationship.source_class
|
|
33
|
+
|
|
31
34
|
mapping = mapping_for(source_record)
|
|
32
35
|
|
|
33
36
|
if source_record.persisted?
|
data/prim.gemspec
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = "prim"
|
|
3
|
-
s.version = "0.0.
|
|
3
|
+
s.version = "0.0.8"
|
|
4
4
|
s.date = "2013-01-14"
|
|
5
5
|
s.summary = "Easily manage Rails associations that need a primary member."
|
|
6
6
|
s.description = "With Prim it's easy to add a primary member to any one-to-many or many-to-many association. " +
|