Ruby on Rails
Thursday, January 31, 2019
My Picture model has a :name column which is just string but what it stores looks like an object Rails says the row has an error :name is blank Do I have this model setup right?
-- p=Picture.first
p.valid?
=> false
p.errors
=> #<ActiveModel::Errors:0x00564c8503f700 @base=#<Picture id: 2, comment: "Henry McCarty", imageable_id: 1, imageable_type: "Photo", content_type: nil, created_at: "2018-09-20 02:08:02", updated_at: "2018-10-25 13:41:24", name: "Billy_the_Kid_Ferrotype.jpg", designation: nil, blog_id: nil, caption: "Unretouched original ferrotype of Bonney c. 1880", details: "Henry McCarty", copyright_claim: false, source_page: nil, slug: nil>, @messages={:name=>["translation missing: en-US.activerecord.errors.models.picture.attributes.name.blank"]}, @details={:name=>[{:error=>:blank}]}>
p.name
=> #<PictureUploader:0x00564c8171dd00 @model=#<Picture id: 2, comment: "Henry McCarty", imageable_id: 1, imageable_type: "Photo", content_type: nil, created_at: "2018-09-20 02:08:02", updated_at: "2018-10-25 13:41:24", name: "Billy_the_Kid_Ferrotype.jpg", designation: nil, blog_id: nil, caption: "Unretouched original ferrotype of Bonney c. 1880", details: "Henry McCarty", copyright_claim: false, source_page: nil, slug: nil>, @mounted_as=:name, @storage=#<CarrierWave::Storage::File:0x00564c8171d710 @uploader=#<PictureUploader:0x00564c8171dd00 ...>>, @file=#<CarrierWave::SanitizedFile:0x00564c8171d288 @file="/home/fugee/data/websites/thekidslepthere/public/images/Billy_the_Kid_Ferrotype.jpg", @original_filename=nil, @content_type=nil>, @versions={:thumb=>#<PictureUploader::Uploader47443268402420:0x00564c8171d238 @model=#<Picture id: 2, comment: "Henry McCarty", imageable_id: 1, imageable_type: "Photo", content_type: nil, created_at: "2018-09-20 02:08:02", updated_at: "2018-10-25 13:41:24", name: "Billy_the_Kid_Ferrotype.jpg", designation: nil, blog_id: nil, caption: "Unretouched original ferrotype of Bonney c. 1880", details: "Henry McCarty", copyright_claim: false, source_page: nil, slug: nil>, @mounted_as=:name, @parent_version=#<PictureUploader:0x00564c8171dd00 ...>, @storage=#<CarrierWave::Storage::File:0x00564c8171d198 @uploader=#<PictureUploader::Uploader47443268402420:0x00564c8171d238 ...>>, @file=#<CarrierWave::SanitizedFile:0x00564c8171cce8 @file="/home/fugee/data/websites/thekidslepthere/public/images/thumb_Billy_the_Kid_Ferrotype.jpg", @original_filename=nil, @content_type=nil>, @versions={}>}>
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 rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/072a0839-d57f-43b7-a92b-a7da15dc4429%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment