Skip to content
Browse files

Updated has() so min/max cannot be passed in as options

  • Loading branch information...
1 parent abeeeba commit 1c606daa00ac545ca8b42758da61f9bebd79243e Dan Kubb committed Apr 20, 2008
Showing with 1 addition and 11 deletions.
  1. +1 −1 lib/data_mapper/associations.rb
  2. +0 −10 spec/unit/associations_spec.rb
View
2 lib/data_mapper/associations.rb
@@ -48,7 +48,7 @@ def n
#
# @public
def has(cardinality, name, options = {})
- options = extract_min_max(cardinality).merge(options)
+ options = options.merge(extract_min_max(cardinality))
if options[:max] == 1
one_to_one(name, options)
View
10 spec/unit/associations_spec.rb
@@ -35,16 +35,6 @@ class Manufacturer
end.should raise_error(ArgumentError)
end
- # FIXME: perhaps this shouldn't be allowed?
- it "should allow overwriting of the auto assigned min/max values with keys" do
- Manufacturer.should_receive(:one_to_many).
- with(:vehicles, {:min=>1, :max=>10}).
- and_return(@relationship)
- class Manufacturer
- has 1..2, :vehicles, :max=>10
- end
- end
-
describe "one-to-one syntax" do
it "should create a basic one-to-one association with fixed constraint" do
Manufacturer.should_receive(:one_to_one).

0 comments on commit 1c606da

Please sign in to comment.
Something went wrong with that request. Please try again.