Permalink
Browse files

Work with Sequel 3.10.0+ one_to_one associations, bump version to 1.2.5

  • Loading branch information...
1 parent 9c0fae9 commit 3ca5decbe2ae4fb7d8538e586c504dbefb44fe28 @jeremyevans committed Oct 18, 2010
Showing with 6 additions and 2 deletions.
  1. +1 −1 fixture_dependencies.gemspec
  2. +5 −1 lib/fixture_dependencies/sequel.rb
View
2 fixture_dependencies.gemspec
@@ -1,6 +1,6 @@
spec = Gem::Specification.new do |s|
s.name = "fixture_dependencies"
- s.version = "1.2.4"
+ s.version = "1.2.5"
s.author = "Jeremy Evans"
s.email = "code@jeremyevans.net"
s.platform = Gem::Platform::RUBY
View
6 lib/fixture_dependencies/sequel.rb
@@ -2,7 +2,11 @@ class << FixtureDependencies
private
def add_associated_object_S(reflection, attr, object, assoc)
- object.send("add_#{attr.to_s.singularize}", assoc) unless object.send(attr).include?(assoc)
+ if reflection[:type] == :one_to_one
+ object.send("#{reflection[:name]}=", assoc)
+ else
+ object.send("add_#{attr.to_s.singularize}", assoc) unless object.send(attr).include?(assoc)
+ end
end
def model_find_S(model, pk)

0 comments on commit 3ca5dec

Please sign in to comment.