On Thursday, January 31, 2019 at 4:38:52 PM UTC-5, Walter Lee Davis wrote: > > > > On Jan 31, 2019, at 3:50 PM, fugee ohu <[email protected] <javascript:>> > wrote: > > > > I had to remove a validation on the :name column because my > PictureUploader which uses Carrierwave is mounted on that column > > mount_uploader :name, PictureUploader > > This causes validation > > validates :name, presence: true > > to cause rows in pictures to be invalid for blank :name even though the > name, just a filename, is in the database for that column > > CarrierWave overloads the accessor for the attachment column to respond > with the entire uploader model object. This is normal for CarrierWave. > > There are other attachment systems (I'm fond of Shrine) that use a > different, less-surprising approach. In Shrine, you would have a column > called picture_data and an attachment called picture. That way you can keep > the difference between db column and virtual object separate. > > Walter > > > > > -- > > You received this message because you are subscribed to the Google > Groups "Ruby on Rails: Talk" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to [email protected] <javascript:>. > > To post to this group, send email to [email protected] > <javascript:>. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/rubyonrails-talk/8f78599a-5e59-43e1-8d1e-ec38e897c68d%40googlegroups.com. > > > > For more options, visit https://groups.google.com/d/optout. >
If the uploader's mounted on that column do I still have to validate it ? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/822db871-615d-4afa-94ad-ea0a3c5b001e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

