-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Datamapper keep trying to validate my image fields as a string #87
Comments
Nobody? really? I'm just trying to use the most basic function of Carrierwave with datamapper, nothing fancy. No one is able to help me ? |
I'm also having trouble getting Carrierwave working with Datamapper. A barebones Sinatra example that I'm testing with: When I try to upload a file, I get this console output: Here are the gems I have installed: FWIW I have no trouble using Carrierwave without Datamapper. As a workaround I am currently storing the file path as a string in the model. However once I add mount_uploader into my model it stops working. Quite frustrating... any suggestions would be greatly appreciated. |
I ran into the same problem. If you embed your property definition into an without_auto_validations block the problem is gone. Also carrierwave does not mark my models dirty once I assign a new file. |
Thanks Markus! That seemed to do the trick. Cheers, |
mbj: the dirty tracking issue should be solved on master. A real pain in the ass. Not sure what to do about the auto validations thing, maybe just a doc patch? |
Im also have a lot of trouble with DataMapper. I've found that you can use :auto_validation => false on your property to get past the validation issue. However, we're still not able to get the field marked as dirty on master. |
Any of you got CarrierWave working w/ Datamapper at all? |
As far as I know, it is still only usable with a workaround, as described by mbj and wprater above. The problem with DataMapper not marking the field as dirty means that in practice, updates to a model that only affect the CarrierWave field don't get applied unless another field is also modified before saving. A fix was proposed for this bug over here: https://github.com/jnicklas/carrierwave/issues#issue/142 |
I must have a different issue than. It saves the uploads to disk, but doesn't attach them to the model (even though other fields are being saved fine). |
I got datamapper w carrierwave working successfully in a medium sized ab. Im using carrierwave to attach files to my image models. These models are immutable you can create and destory them, but not do any updates on them. So the dirty issue does not hit me. I begun to dig the carrierwave and datamapper sources, maybe I'll find some workarounds. I'll add pull requests on success. |
I'm going to close this issue and add the note about validations from wprater to the wiki. If you are afraid that's not visible enough, please provide a documentation patch in a pull request. |
I'm not 100% sure what to put there :( I put something, but can someone who knows about this please review and make any necessary edits? Thank you! Again, this may be worth a documentation patch. I'd welcome a pull request! |
Hi,
using datamapper 10.0.
I have a class as follow:
class Site
include DataMapper::Resource
property :id, Serial
property :titre, String
property :created_at, DateTime
property :route, String
property :image, String
property :caption, Text
property :tips, Text
property :annee, Integer
When I try to stick my file object from a form upload into the image fields, datamapper expect a a String and returns an error, my site object failing validation.
Any clue ?
Thanks
The text was updated successfully, but these errors were encountered: