RMagick gem problem using Rails and possibly WEBRick


#1

Hello, I am new to rails but have been having fun so far. Until now.
I
am sure this is just my inexperience but I have the RMagick gem (ruby
gem
for using imagemagick manipulation) installed on my machine that I
would
like to then use in my rails app. I first installed it and tried it
out,
and it didnt do anything for me, took me a while to realize I needed
the
windows RUBYOPT rubygems environment variable set. After that, I
could
finally call stuff like:

ruby myLittleTestProg.rb

which used a
require ‘RMagick’
and it would run fine.

So I think, I tested my little script out, I want to do it on rails
and
call it from my web app. I build a skeleton web app, and goto the
config/environment.rb file and say:
require ‘RMagick’

adding this line, kills the skeleton app, what ran fine with webrick
now
gives me a strange error that I wll post here. (and yes after
changing the
environment.rb file I did relaunch the server). I installed the
flickr
gem as well, and this runs fine, I can easily say in the
environment.rbfile:
require ‘flickr’
and it works, it is just when I require ‘RMagick’ from that
environment.rbfile in my rails app it crashes with this error in the
index.rhtml:

I am looking for any suggestions, cause I am totally lost. Not sure
why
the RMagick include runs fine when I just use it from a ruby .rb file,
but
when I try to require it from my rails app, it doesnt work…this is
locally
using WEBrick (i tried my rails host online, and it seems that the
require
RMagick works there, I just need to get it working locally for
development
and testing purposes…)

Thanks for anyone with any help or suggestions…

-Shane
error is as follows when require ‘RMagick’ is added to environment.rb
of a
skeleton rails app:

SyntaxError in imagemod#index

Showing app/views/imagemod/index.rhtml where line #2 raised:

compile error
./script/…/config/…/app/views/imagemod/index.rhtml:2: parse error,
unexpected $, expecting kEND

Extracted source (around line #2):

1: <%= form_remote_tag :url = {:action = ‘search’}, :update =
‘photos’ %
2: <fieldset
3: <label for=“tags” Tags:</label
4: <%= text_field_tag ‘tags’ %

5: <%= submit_tag ‘Find’ %

Trace of template inclusion: /app/views/imagemod/index.rhtml

RAILS_ROOT: ./script/…/config/…
Application Trace <http://localhost:3000/imagemod# | Framework
Trace<http://localhost:3000/imagemod# | Full
Trace <http://localhost:3000/imagemod#

#{RAILS_ROOT}/app/views/imagemod/index.rhtml:2:in `compile_template’

C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:305:in
compile_and_render_template' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:290:inrender_template’
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:249:in
render_file' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:699:inrender_file’
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:621:in
render_with_no_layout' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/layout.rb:243:inrender_without_benchmark’
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:53:in
render' C:/InstantRails-1.0/ruby/lib/ruby/1.8/benchmark.rb:293:inmeasure’
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:53:in
render' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:913:inperform_action_without_filters’
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:368:in
perform_action_without_benchmark' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:inperform_action_without_rescue’
C:/InstantRails-1.0/ruby/lib/ruby/1.8/benchmark.rb:293:in measure' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:inperform_action_without_rescue’
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/rescue.rb:82:in
perform_action' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:381:inprocess_without_filters’
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:377:in
process_without_session_management_support' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/session_management.rb:117:inprocess’
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:in
dispatch' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:115:inhandle_dispatch’
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:81:in
service' C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:inservice’
C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in
run' C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/server.rb:173:instart_thread’
C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/server.rb:162:in
start_thread' C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/server.rb:95:instart’
C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/server.rb:92:in start' C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/server.rb:23:instart’
C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/server.rb:82:in start' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:67:indispatch’
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/servers/webrick.rb:59
C:/InstantRails-1.0/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
require' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:inrequire’
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/server.rb:30
C:/InstantRails-1.0/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
require' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:inrequire’
script/server:3

#{RAILS_ROOT}/app/views/imagemod/index.rhtml:2:in compile_template' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:305:incompile_and_render_template’
C:/InstantRails-
1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:290:in
render_template' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:249:inrender_file’
C:/InstantRails-
1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:699:in
render_file' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:621:inrender_with_no_layout’

C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/layout.rb:243:in
render_without_benchmark' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:53:inrender’

C:/InstantRails-1.0/ruby/lib/ruby/1.8/benchmark.rb:293:in measure' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:53:inrender’
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-
1.12.1/lib/action_controller/base.rb:913:in
perform_action_without_filters' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:368:inperform_action_without_benchmark’

C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in
perform_action_without_rescue' C:/InstantRails-1.0/ruby/lib/ruby/1.8/benchmark.rb:293:inmeasure’
C:/InstantRails-
1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in
perform_action_without_rescue' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/rescue.rb:82:inperform_action’

C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:381:in
process_without_filters' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:377:inprocess_without_session_management_support’

C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/session_management.rb:117:in
process' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:indispatch’

C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:115:in
handle_dispatch' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:81:inservice’
C:/InstantRails-
1.0/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in service' C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:inrun’
C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/server.rb:173:in
start_thread' C:/InstantRails- 1.0/ruby/lib/ruby/1.8/webrick/server.rb:162:instart_thread’
C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/server.rb:95:in start' C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/server.rb:92:instart’
C:/InstantRails-
1.0/ruby/lib/ruby/1.8/webrick/server.rb:23:in start' C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/server.rb:82:instart’
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:67:in
`dispatch’

C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/servers/webrick.rb:59
C:/InstantRails-1.0/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
require' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/activesupport- 1.3.1/lib/active_support/dependencies.rb:147:inrequire’
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/server.rb:30
C:/InstantRails-1.0/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
`require’

C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in
`require’
script/server:3

Request

Parameters: None

Show session dump <http://localhost:3000/imagemod#


flash: !map:ActionController::Flash::FlashHash {}

Response Headers: {“cookie”= [], “Cache-Control”= “no-cache”}


-Shane

Sites:
Photo
http://www.thomascustomdigital.com
Coding
http://www.viciousbytes.com
fun
http://www.flickr.com/photos/codejoy
blog
http://codejoy.blogspot.com


#2

rmagick does not work with ruby 1.8.4 on windows. Replace any of these
three
with something else and it will work.


#3

correct. i had to downgrade to 1.8.2.


#4

Sam D. wrote:

correct. i had to downgrade to 1.8.2.

thanks so much guys, is it easy to downgrade?
still that new to this im not sure…


#5

Windows XP
ruby 1.8.4 (2005-12-24) [i386-mswin32]
Rails 1.1.2
RMagick-win32 (1.9.2)
WEBrick 1.3.1

File_column with RMagick works fine for me.
I just tried it with skeleton app, that had require ‘RMagick’ in
environment.rb and that worked ok too. Strange…