Closed regdog closed 11 years ago
I figure it out now. The gem creates RedactorRails::Picture model to save the uploaded pictures and the blog entry just need to embed the picture paths in the body text.
But I met a issue when uploading picture as following. I found the same issue reported around the internet http://pastie.org/pastes/4270763 and http://stackoverflow.com/questions/17683481/minimagickerror-failed
POST http://localhost:3000/redactor_rails/pictures?authenticity_token=BNfnhst4ABl%2BOzo6MLAGc19%2BYX6rV2PxK9yEOu8u2vw%3D 500 (Internal Server Error)
MiniMagick::Error at /pictures Command ("identify -quiet -ping -format %wn /home/wangyang/Repository/demo/lifecare/tmp/uploads/1374199736-21134-7536/p135984554.jpg") failed: {:status_code=>127, :output=>"sh: 1: identify: not found\n"}
I am using rails 3.2.13, devise, carrierwave and carrierwave-mongoid following the installation instruction, no customized devise user model.
I find the reason. Just installing the ImageMagick package on my system will solve the issue.
I am happy to find this great gem. While I still don't figure out how to upload picture with carrierwave and mongoid. For example, I have a Blog model and field body which user can upload multiple pictures. What is the correct way to upload pictures to a blog entry?
Should I make the blog model and RedactorRails::Picure model as related models?
Class Blog ... has_many :pictures, :class => 'RedactorRails::Picure' accepts_nested_attributes_for :pictures end
Class RedactorRails::Picture < RedactorRails::Asset ... belongs_to :blog end
Then how to handle in the new/edit form and the controller?
Could you have a tutorial wiki to explain it? Thanks!