Question

A rails3 application with Carrierwave and MiniMagick is loading files. However in an attempt to get meta-information out it is hitting Errno::ENOENT

The helper method

  def image
    @document = Document.find(params[:id])
    image = MiniMagick::Image.open(@document.production_file)
  end

is called in the view

<%= image['width'] %>

but the error is specified as

No such file or directory - /uploads/document/production_file/1/leader_pg_600.jpg

Yet

localhost:3000/uploads/document/production_file/1/leader_pg_600.jpg

does show the file, and is identical to

<%= @document.production_file_url %>

why is this routing apparently not being seen?

ImageMagick is installed and the application is running a resizing manipulation.

Was it helpful?

Solution

Accessing the wrong form of information...

image = MiniMagick::Image.open(@document.production_file)

is only a string. Should read

image = MiniMagick::Image.open(@document.production_file.path)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top