prim 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/prim/collection.rb +3 -0
  2. data/prim.gemspec +1 -1
  3. metadata +1 -1
@@ -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?
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "prim"
3
- s.version = "0.0.7"
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. " +
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prim
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: