Application doesn't work on two different machines

Hello,

I’ve got an application which I am developing on a Windows machine and
everything works just fine. Once I upload it on my server (Debian) and
test it I get following error:
ActionView::TemplateError (undefined local variable or method `filename’
for #News:0x41105540) on line #8 of news/index.html.erb:
5:
6:


7:
8: <%= image_tag(news.public_filename)
%>

9: Erstellt am <%=
news.created_at.strftime("%d.%m.%Y") %>

10: von <%=h news.author %>
11:

I’m using attachment_fu.

Anyone knows why it doesn’t work on my debian machine?

Thanks

Start by making sure you are running the exact same versions of both
ruby and rails. Make sure all of your gems and gem versions are the
same. Make sure you are including rubygems (require ‘rubygems’) before
requiring your gems in environment.rb to make sure there are no
conflicts.

I personally go through my production server and run an irb require test
on every gem I use on development…

irb

require ‘rubygems’
require ‘name of gem’
require ‘name of next gem’
=> all should come as ‘true’

After you’ve done that, read the following regarding the image paths you
are having trouble with:

http://www.ruby-forum.com/topic/164189

Your issue and his are similar.

It looks like you are using a plugin such as attachment_fu. Ensure
that you have that included in your deployment to production.

Cheers,
Nicholas

On Jul 2, 9:31 am, Heinz S. [email protected]

Yeah, it’s gotta be something to do with attachment_fu cause I’m calling
a attachment_fu function.
I just realized that my Windows machine has rmagick (2.9.0) installed
and Debian rmagick (1.15.0). That could be the reason right?

Just gotta figure out how to update rmagick then…
checking for wand/MagickWand.h… no
Can’t install RMagick 2.10.0. Can’t find MagickWand.h.

Wrong forum I know but anybody knows what the heck is going on there?

Nicholas H. wrote:

  1. I wouldn’t have thought the RMagick version would have mattered,
    can you confirm the attachment_fu is being deploy to your production
    environment?
    attachment_fu is inside the plugins folder so should be alright=
  2. Perhaps try upgrading imagemagick first before installing rmagick.
    i updated imagemagick by compiling and installing it manually but now i
    get this error message
    Cheers,
    Nicholas

On Jul 2, 10:56�am, Heinz S. [email protected]

  1. I wouldn’t have thought the RMagick version would have mattered,
    can you confirm the attachment_fu is being deploy to your production
    environment?

  2. Perhaps try upgrading imagemagick first before installing rmagick.

Cheers,
Nicholas

On Jul 2, 10:56 am, Heinz S. [email protected]

Putting aside the RMagick issue (can’t really help you there), do you
have the full error trace for:

ActionView::TemplateError (undefined local variable or method
`filename’
for #News:0x41105540) on line #8 of news/index.html.erb:

On Jul 3, 11:26 am, Heinz S. [email protected]

Yes:
ActionView::TemplateError (undefined local variable or method `filename’
for #News:0x40f5a7a4) on line #8 of news/index.html.erb:
5:
6:


7:
8: <%= image_tag(news.public_filename) %>

9: Erstellt am <%= news.created_at.strftime("%d.%m.%Y") %>

10: von <%=h news.author %>
11:
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/attribute_methods.rb:256:in 

method_missing' vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb:233:inthumbnail_name_for’
vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/file_system_backend.rb:21:in
full_filename' vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/file_system_backend.rb:43:inpublic_filename’
app/views/news/index.html.erb:8:in
_run_erb_47app47views47news47index46html46erb' app/views/news/index.html.erb:1:ineach’
app/views/news/index.html.erb:1:in
_run_erb_47app47views47news47index46html46erb' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/base.rb:338:insend’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/base.rb:338:in
execute' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/template_handlers/compilable.rb:29:insend’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/template_handlers/compilable.rb:29:in
render' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/template.rb:35:inrender’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/template.rb:22:in
render_template' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/base.rb:245:inrender_file’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:1108:in
render_for_file' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:865:inrender_with_no_layout’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:880:in
render_with_no_layout' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/layout.rb:251:inrender_without_benchmark’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:51:in
render' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/core_ext/benchmark.rb:8:inrealtime’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:51:in
render' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/mime_responds.rb:131:insend’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/mime_responds.rb:131:in
custom' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/mime_responds.rb:160:incall’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/mime_responds.rb:160:in
respond' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/mime_responds.rb:154:ineach’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/mime_responds.rb:154:in
respond' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/mime_responds.rb:107:inrespond_to’
app/controllers/news_controller.rb:22:in index' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:1162:insend’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:1162:in
perform_action_without_filters' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:580:incall_filters’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:573:in
perform_action_without_benchmark' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:68:inperform_action_without_rescue’
/usr/local/lib/ruby/1.8/benchmark.rb:293:in measure' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:68:inperform_action_without_rescue’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/rescue.rb:201:in
perform_action_without_caching' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/caching/sql_cache.rb:13:inperform_action’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in
cache' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/query_cache.rb:8:incache’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/caching/sql_cache.rb:12:in
perform_action' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:529:insend’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:529:in
process_without_filters' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:569:inprocess_without_session_management_support’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/session_management.rb:130:in
process' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:389:inprocess’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:149:in
handle_request' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:107:indispatch’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:104:in
synchronize' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:104:indispatch’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:120:in
dispatch_cgi' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:35:indispatch’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:76:in
process' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:insynchronize’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in
process' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:inprocess_client’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in
each' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:inprocess_client’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in
run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:ininitialize’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in
new' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:inrun’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in
initialize' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:innew’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in
run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:282:inrun’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in
each' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:inrun’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in
run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/command.rb:212:inrun’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
/usr/local/bin/mongrel_rails:19:in `load’
/usr/local/bin/mongrel_rails:19

Rendering /var/www/web/htdocs/releases/20090612181632/public/500.html
(500 Internal Server Error)

Local Windows machine:
Rails 2.2.2
ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]
gem 1.3.2

Debian machine (not working on this machine):
Rails 2.2.2
ruby 1.8.7 (2008-05-31 patchlevel 0) [i686-linux]
gem 1.3.1

Which version of rails are you developing with locally?

On Fri, Jul 3, 2009 at 11:54 AM, Heinz

I think in your production environment you are using an older version
of Rails (review your error trace):

/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/

You should vendor your rails with your application to avoid this in the
future.

Looks like it’s an incompatibility with the version of attachment_fu
and active-record/rails.

Cheers,
Nicholas

On Fri, Jul 3, 2009 at 12:05 PM, Heinz

Hey,

I was running 2.1.0 on my local machine as well but I updated it to
2.2.2 but with no effect:
ActionView::TemplateError (undefined local variable or method `filename’
for #News:0x40ec017c) on line #8 of app/views/news/index.html.erb:
5:
6:


7:
8: <%= image_tag(news.public_filename) %>

9: Erstellt am <%= news.created_at.strftime("%d.%m.%Y") %>

10: von <%=h news.author %>
11:
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/attribute_methods.rb:260:in 

method_missing' vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb:233:inthumbnail_name_for’
vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/file_system_backend.rb:21:in
full_filename' vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/file_system_backend.rb:43:inpublic_filename’
app/views/news/index.html.erb:8
app/views/news/index.html.erb:1:in each' app/views/news/index.html.erb:1 /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/renderable.rb:39:insend’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/renderable.rb:39:in
render' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/template.rb:73:inrender_template’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/base.rb:256:in
render' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/base.rb:367:in_render_with_layout’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/base.rb:254:in
render' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:1174:inrender_for_file’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:905:in
render_without_benchmark' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/benchmarking.rb:51:inrender’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/core_ext/benchmark.rb:8:in
realtime' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/benchmarking.rb:51:inrender’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/mime_responds.rb:135:in
send' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/mime_responds.rb:135:incustom’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/mime_responds.rb:164:in
call' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/mime_responds.rb:164:inrespond’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/mime_responds.rb:158:in
each' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/mime_responds.rb:158:inrespond’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/mime_responds.rb:107:in
respond_to' app/controllers/news_controller.rb:22:inindex’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:1253:in
send' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:1253:inperform_action_without_filters’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/filters.rb:617:in
call_filters' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/filters.rb:610:inperform_action_without_benchmark’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/benchmarking.rb:68:in
perform_action_without_rescue' /usr/local/lib/ruby/1.8/benchmark.rb:293:inmeasure’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/benchmarking.rb:68:in
perform_action_without_rescue' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/rescue.rb:136:inperform_action_without_caching’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/caching/sql_cache.rb:13:in
perform_action' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/query_cache.rb:34:incache’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/query_cache.rb:8:in
cache' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/caching/sql_cache.rb:12:inperform_action’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:524:in
send' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:524:inprocess_without_filters’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/filters.rb:606:in
process_without_session_management_support' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/session_management.rb:134:inprocess’

Any other ideas?

I meant attachment_fu

I just updated attachment_fu and did a db:migrate:reset and now
everything works like a charm :slight_smile: Thank you!

OK, could have been a version conflict between Rails and
attachment-fu. One thing I didn’t think of asking was to ensure you
had run the migrations in production. Pleased to hear you are good to
go.

Cheers,
Nicholas

On Fri, Jul 3, 2009 at 12:55 PM, Heinz

Have you tried updating attribute_fu? Where did you source it from?

On Fri, Jul 3, 2009 at 12:43 PM, Heinz