
dm-constraints broken with one_to_many :through?
Reported by Antti | March 31st, 2009 @ 01:30 AM
When using dm_constraints with has n, :subjects, :through =>
:some_model
/usr/local/lib/ruby/gems/1.8/gems/extlib-0.9.11/lib/extlib/hook.rb:305:in
initialize': The options constraint are required (ArgumentError)
<br/>
from /usr/local/lib/ruby/gems/1.8/gems/extlib-0.9.11/lib/extlib/hook.rb:303:in `catch'
from /usr/local/lib/ruby/gems/1.8/gems/extlib-0.9.11/lib/extlib/hook.rb:303:in `initialize'
from /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/associations/one_to_many.rb:56:in `new'
from /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/associations/one_to_many.rb:56:in `setup'
from /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/associations.rb:122:in `has'
Comments and changes to this ticket
-
Antti April 1st, 2009 @ 06:09 AM
Here's how to reproduce this:
require 'dm-core' require 'dm-constraints' class Book include DataMapper::Resource property :id, Serial belongs_to :author has n, :reviews end class Review include DataMapper::Resource property :id, Serial belongs_to :book end class Author include DataMapper::Resource property :id, Serial has n, :books has n, :review, :through => :books end
This raises:
/usr/local/lib/ruby/gems/1.8/gems/extlib-0.9.11/lib/extlib/hook.rb:305:in `initialize': The options constraint are required (ArgumentError) from /usr/local/lib/ruby/gems/1.8/gems/extlib-0.9.11/lib/extlib/hook.rb:303:in `catch' from /usr/local/lib/ruby/gems/1.8/gems/extlib-0.9.11/lib/extlib/hook.rb:303:in `initialize' from /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/associations/one_to_many.rb:56:in `new' from /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/associations/one_to_many.rb:56:in `setup' from /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/associations.rb:122:in `has'
There is no problem when i use 0.9.10 version.
Environment: ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-freebsd8]
-
Marcin Kulik April 22nd, 2009 @ 09:32 AM
The same problem here. DM gems 0.9.11 , extlib 0.9.11, ruby 1.8.7 (patchlevel 72)
-
-
Dan Kubb (dkubb) May 28th, 2009 @ 07:26 PM
- State changed from unconfirmed to accepted
- Assigned user set to Dan Kubb (dkubb)
-
Dan Kubb (dkubb) June 7th, 2009 @ 01:49 AM
- State changed from accepted to resolved
I can confirm this is now resolved with the dm-core/next and dm-more/next branch.
Attached is a script that demonstrates the fix.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »