-
-
Notifications
You must be signed in to change notification settings - Fork 264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding an association object when parent doesn't exist fails #1
Comments
Hi, I'm having some trouble recreating your error. I created a new branch in which I added a test that tests your exact usage case...and it passes. Could I ask you to checkout the new branch I added (https://github.com/ErwinM/acts_as_tenant/tree/orphan_models) and make the test fail to illustrate your issue? Thanks :) |
Hi Erwin, I believe it's failing without raising errors. If I run the following test it fails stating it returned false:
Thanks! |
Hi, You are right of course: the model will fail its validation and not raise an error. Oversight on my part. I think i added support for child models without a parent. I just released a new version (0.2.4) that contains the change and passes the spec above. Could you let me know if this solves the issue in your code as well? Thanks! |
That did it! Thanks for your help:) |
Glad I could help! |
Add 'counter_cache' to association options
Hi,
I am having the following issue (using the spec example from your code).
If I attempt to add a task without it belonging to a project the following SQL is run
and the task is not saved. This is happening as well when I use accepts_nested_attributes_for within my model. I'm assuming rails is saving the Task before the Project and therefor creating this error.
Thanks for the gem and your help!
The text was updated successfully, but these errors were encountered: