reform
reform copied to clipboard
"stack level too deep" for self-included forms
Hello again.
I have another problem with my not-normal form:
lass PostCommitAction::ConditionGroupForm < Reform::Form
include Reform::Form::ModelReflections
model 'post_commit_action/condition_group'
property :cond_type
collection :condition_groups,
form: PostCommitAction::ConditionGroupForm
end
I get "stack level too deep" when try to validate params. It appears even without filled nested form
Test application - https://github.com/Tab10id/reform_test_app
That fails because you have a recursion: each condition_groups
form has another condition_groups
form. Did that work in 1.x?
Sorry but this my first experience with reform and I don't know how that form would feel in reform 1.x. But why I can't do that? I getting tasks with self-joins pretty often. I think there should be something like that:
collection :condition_groups,
form: PostCommitAction::ConditionGroupForm,
lazy: true
If it is possible in reform architecture of course
Sorry for my English
No problem, and your english is great.
You are right, this should be possible, and I actually know where the problem is and I want to fix that, too. This problem appeared with Reform 2.0, that's why I asked.
I will let you know if I make any progress.
Please try that with Disposable-0.1.9 and close this issue if that got fixed for you. :fireworks: :smile:
Sorry but stack level is still too deep=) https://github.com/Tab10id/reform_test_app updated
I can't provoke this problem anymore, please prepare a minimal test file in your sample app. Thanks!
Does that only happen when calling validate
?
Ah ok I think I know where the problem is. I have no idea how to fix this currently, sorry. The problem is that we compile the deserializer at run-time, which goes through the form's structure. In your case, you specify an infinite loop. How many levels does your form have? If it's only one, then your form declaration is wrong, anyway.
Idea was about form with not-limited count of levels. I'll try to prepare app with that tests today. Hope that will work fine in future versions of reform. Anyway, thanks for a attempt of quick fix.
PS: Honestly I don't really need multilevel form in real project, it was just test of reform functionality=)
Hahaha! :laughing: Wait, you don't need to prepare a test, I found out how to provoke that.
The thing is, "multilevel" is not a problem, you can have any kind of nesting, the only issue is the automatic inferral of the deserializing representer (which is something that shouldn't bother you!). I find this an interesting problem, and you've already helped me to improve Disposable so I am keen to make this feature possible. Thanks!!!! :beers:
@apotonick is there any update on this? I bumped into it a while ago and took it as a warning shot to revisit what I was doing :) If there aren't plans to further this, and it's not a real issue for Tab10id then can we close?