Rmagick working in console but not in my app

hey all,
When I do this in script/console I get:

require ‘RMagick’
=> true

include Magick
=> Object

f = Image.new(100,100) { self.background_color = “red” }
=> 100x100 DirectClass 16-bit

f.crop_resized(50,50)
=> 50x50 DirectClass 16-bit

But in my application I keep getting the same error as if rmagick was
not installed though it is and I can use it with irb. This is the
error I get:

ActionView::TemplateError (undefined method `crop_resized’ for
nil:NilClass) on line #7 of app/views/items/list.rhtm

I did put
require ‘RMagick’
and
include Magick
in my application.rb but my rmagick install keeps getting ignored :confused:
any idea what’s wrong or where shall I put include Magick and require
‘RMagick’?

thanx in advance

Pat

Patrick A. wrote:

But in my application I keep getting the same error as if rmagick was
not installed though it is and I can use it with irb. This is the
error I get:

ActionView::TemplateError (undefined method `crop_resized’ for
nil:NilClass) on line #7 of app/views/items/list.rhtm

Notice that the message says that crop_resized' is not defined for a nil object. This doesn't indicate a problem with RMagick or how you've installed it, it indicates that the object you're callingcrop_resized’
is nil.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs