
Getting error "stack level too deep" if class contains word "fields"
Reported by Sean | February 27th, 2010 @ 11:53 AM | in 1.1.1
Very strange bug, I am not sure if "fields" is a reserved word in DM.
A has many B, B is referenced as :fields in A
C has many D, C is referenced as :fields in C
A has many C
Run the attached file will give "stack level too deep" error, but if change the hash :field with :flds or :props etc, it works.
Comments and changes to this ticket
-
Alex April 17th, 2010 @ 04:45 PM
I'm having this same problem after updating to the latest DM. I have a model called Field which is referenced in a "has n" association from another model.
I pulled the latest dm-core and found that DataMapper::Resource defines #fields, which explains the stack level too deep issue. The method is marked as part of the private API. I tried renaming the method to _fields, in order to avoid the method naming conflict, but wasn't able to run "rake spec" to see if my change was OK.
Are there some instructions somewhere about how to run the dm-core test suite? I wasn't able to find anything.
-
Martin Gamsjaeger (snusnu) April 18th, 2010 @ 10:37 AM
- Milestone set to 1.0.0
- State changed from new to confirmed
I can confirm that this happens with lastest master branches: http://github.com/snusnu/dm-snippets/commit/3d9b12a5da678e11e412ec6...
-
Alex April 18th, 2010 @ 02:35 PM
This appears to be localized to the Resource module. I can't identify any calls to the #fields method from outside this module. So far I haven't spotted any undesirable consequences after renaming #fields to #_fields. My changes are here: http://github.com/alexkwolfe/dm-core/commit/51b4fb202cb3265ce6ee88b.... I'm happy to send a pull request, but as I said before, I have been unable to run the specs.
Naturally, there is a broader discussion regarding what to do with methods added to a model by DM. I'll leave that for someone else to worry about. =)
-
Dan Kubb (dkubb) May 26th, 2010 @ 01:23 AM
- Milestone cleared.
-
Piotr Solnica (solnic) March 24th, 2011 @ 06:37 AM
- Milestone set to 1.1.1
- Milestone order changed from 0 to 0
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 »