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
Refinery::Image delete in overview => Error on association #2489
Comments
That makes sense.. if you delete an image it's going to be nil? |
Yes it makes sense and also not :-). Is there a workaround to fix that? |
The workaround you suggested, yes. |
Why not fix this within refinery? For example, if an image is associated to something, it is not deletable? A before filter for example "This image is associated to.., not deletable".. ? |
How does the image know what it's associated with? |
Yes that's the problem. Maybe it could be fixed within the refinery-images gem. For own extensions everybody must fixed it individually...hmm. |
Currently other models own the foreign key relationship with images and we'd have to flip that around the other way to implement what you're after. |
I have an own refinery extension, so far so good and everything works.
I have a Project which has a logo => association to Refinery::Image
In the Refinery::Images overview I can edit, update and destroy the image, so far so good.
But no my problem is, that I have validates :presence => true on my project logo. And If I have an image_tag in my views like:
And the image was destroyed on localhost:3000/refinery/images I get an exception
because of the missing image of the association.
Is this a bug or a feature?
Of course I could fix the view exception like:
but that is annoying, because of the presence validation.
The text was updated successfully, but these errors were encountered: