Permalink
Browse files

find_target can also go into SingularAssociation

  • Loading branch information...
1 parent f1a15c2 commit b7594a075637f2d3039b066c282acfcb32126cdf @jonleighton jonleighton committed with tenderlove Jan 16, 2011
@@ -43,10 +43,6 @@ def replace_keys(record)
@owner[@reflection.foreign_key] = record && record[@reflection.association_primary_key]
end
- def find_target
- scoped.first.tap { |record| set_inverse_instance(record) }
- end
-
def foreign_key_present?
@owner[@reflection.foreign_key]
end
@@ -27,10 +27,6 @@ def replace(record, save = true)
end
private
- def find_target
- scoped.first.tap { |record| set_inverse_instance(record) }
- end
-
def association_scope
super.order(@reflection.options[:order])
end
@@ -18,6 +18,10 @@ def build(attributes = {})
end
private
+ def find_target
+ scoped.first.tap { |record| set_inverse_instance(record) }
+ end
+
# Implemented by subclasses
def replace(record)
raise NotImplementedError

0 comments on commit b7594a0

Please sign in to comment.