This project is archived and is in readonly mode.
SystemStackError with has_one
-
Jan De Poorter
I added (in collaboration with lifo on IRC) a patch which adds :validate to has_many, has_one, habtm associations, to disable the automatic validation, which is why this problem occurs.
-
Matt Mower
Thanks Jan.
I would like to mention that Jan also came up with a useful workaround which is to redefine the method that the has_one is generating stubbing it out. In my case this is "validate_associated_records_for_inverse".
Until :validate => false is in place the workaround may help.
-
Pratik
- Assigned user set to Pratik
-
Luke Redpath
Related to my ticket
-
Drew Blas
+1
...Although I echo the sentiment of others that this should NOT be enabled by default. There is no proper documentation of it and the expected behavior is to use validates_associated...that's what validations are for.
-
Pratik
A few changes needed :
- It should be possible to use one of the existing table/model.
- Could you please add :validate option to belongs_to as well ?
Catch me on IRC if you have any questions.
Thanks!
-
Jan De Poorter
@Pratik: I did what you asked, patch attached
-
Repository
- State changed from new to resolved
(from [7f140bbddaf70abc61570f6cfdcbfba5771ffc78]) Add :validate option to associations. [#301 state:resolved]
Signed-off-by: Pratik Naik
-
Repository
(from [23223ce415da13a09287325d114ce2d2e3923edf]) Add :validate option to associations. [#301 state:resolved]
Signed-off-by: Pratik Naik
-
Andrea Campi
- Tag set to 2-3-stable, activerecord, bug, callback, has_one, patch
