File_column with RMagick

I think I must be being really dense… I just can’t get resizing
versions to work with RMagick. Can someone show me an example of a
working configuration?

I’m using Rails 0.14.3, file_column 0.3, and the following doesn’t work:

== db/migrate/010_add_image.rb

class AddItems < ActiveRecord::Migration
self.up
add_column :items, :image, :string
end
end

== app/models/item.rb

class Item < ActiveRecord::Base
file_column :image, :magick => {:versions =>
{ “thumb” => “50x50”,
“medium” => “640x480>”} }
end

== app/controllers/item_controller.rb

class ItemController < ApplicationController
def upload_image
@item = Item.find(params[:id])
@item.image=params[:item][:image]
@item.save
redirect_to :action => ‘show’, :id => params[:id]
end
end

== app/views/item/show.rhtml

<%= image_tag url_for_file_column(‘item’, ‘image’, ‘medium’) %>

==

The last image tag comes out broken, and the thumbnail isn’t created.
No errors are showing in the logs, and google’s not being much help.
Is there anything obvious I’ve missed out?

I spent a day or so fighting this same thing, and it turned out that I
didn’t have RMagick properly installed as a gem.

I actually couldn’t install the gem on any of my environment
platforms, but I was able to get it all working by changing line 84 of
magick_file_column.rb from “require-gem ‘rmagick’” to “require
‘RMagick’”

I understand future versions of file_column (which I love, by the
way) will be more forgiving of how you’ve got RMagick installed.

-eric

Eric W. wrote:

I actually couldn’t install the gem on any of my environment
platforms, but I was able to get it all working by changing line 84 of
magick_file_column.rb from “require-gem ‘rmagick’” to “require
‘RMagick’”
Already done that - I was clued in by Item.find(2) barfing in
script/console. Still no worky.


Alex