Ruby on rails - 1 bug prevented this enum from being saved: image has content that is not what they are reporting
Bug 1 prevented this listing from being saved: Image has content that is not what they are reporting.
This is the error I get when I try to upload an image to print. I've tried various types of validations and nothing seems to work.
This is what my Model looks like .
class Listing < ActiveRecord::Base
has_attached_file :image, :styles => { :medium => "200x", :thumb =>"100x100>" }, :default_url => "default.jpg"
validates_attachment :image, content_type: { content_type: /\Aimage\/.*\Z/ }
end
Can someone explain to me what I did wrong and what I can do to fix it. I really want to keep working on this app, but I got into a problem!
source to share
This could be because you don't have a program file
(perhaps you are not using a Unix system?)
file
used with paperclip to check if the uploaded file is what it should be (based on your validator).
If you are on Windows, you must manually download and install the Windows file and add it to
-
Windows environment variable PATH,
-
project environment (
config/environments/development.rb
, add linePaperclip.options[:command_path] = '{your_path_to_dir_with_file/bin}'
)
After that restart your console, server and it should work.
source to share
This is what you can do for windows only :
- Install exe with
- download exe from this link file.exe
- test if it is well installed, run your cmd and put the following instructions
convert logo: logo.miff
, then run 'imdisplay logo.miff' you will get a custom logo that will appear on your window screen.
Now you can start configuring everything on the rails app
- Open up
config/environments/development.rb
- Add the following line:
Paperclip.options[:command_path] = 'C:\Program Files (x86)\GnuWin32\bin'
- If your rails server is currently running, lock the server and then start s rails again. After that, you should be ready to go. Upload the image to your app.
- Add the following line:
source to share