stack level too deep when trying to add to an association by ID
Reported by Adam French | August 3rd, 2008 @ 12:05 PM
See the attached patch, but basically the following is breaking
it "should have machine when created using machine_id" do
m = Machine.create(:name => 'machineX')
a = Area.new(:machine_id => m.id)
a.machine.should == m
end
Comments and changes to this ticket
-
Bernerd Schaefer August 4th, 2008 @ 01:16 PM
- → State changed from new to resolved
Thanks, Adam. This is fixed in d7a814a.
-

Alex Arnell August 14th, 2008 @ 07:04 PM
If you set the machine_id to something that won't exist like 0 you still get this exception.
a = Area.new(:machine_id => 0) puts a.machine endI guess in this case nil should be returned.
-

-
Adam French August 15th, 2008 @ 11:28 PM
- → State changed from resolved to open
@bryanray found that you can still get a stack-level-too-deep error from the same method if you assign an invalid id (an id of an object that does not exist). For example
# integration/association_spec.rb it "should not have a machine when created using an invalid machine_id" do a = Area.new(:machine_id => 42) a.machine.should be_nil end -
Bryan Ray August 16th, 2008 @ 12:14 AM
This is the 1 line fix that I came up with ... whether or not it is actually the correct way of going about it. I'm not sure.
-
Bryan Ray August 16th, 2008 @ 12:45 AM
This is the other patch that I think is probably better.
(0002 Patch)
-
Foy Savas August 16th, 2008 @ 01:56 AM
- → Assigned user cleared.
Just applied Bryan's changes, which include a spec, to master.
By the way, I definitely recommend giving Bryan commit privileges (to both dm-core and dm-more) - I see many more bug fixes in his future.
-
monki (Wesley Beary) September 3rd, 2008 @ 06:20 PM
- → State changed from open to resolved
Sounds resolved? Reopen if it isn't.
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
