We're sorry, but something went wrong

I’m learning about Paperclip: Attaching Files in Rails, following this
link
http://jimneath.org/2008/04/17/paperclip-attaching-files-in-rails.html

I place these code to display image on show.html.erb
<%= image_tag @user.photo.url %>
<%= image_tag @user.photo.url(:thumb) %>

On new page, I browse a file (.png) from my computer and click create.
Then I got the error
We’re sorry, but something went wrong.

When I check on development.log. I found these errors
Status: 500 Internal Server Error
The system cannot find the path specified
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/utils.rb:486:in
initialize' C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/utils.rb:486:in new’
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/utils.rb:486:in
parse_multipart' C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/utils.rb:471:in loop’
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/utils.rb:471:in
parse_multipart' C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/request.rb:268:in parse_multipart’
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/request.rb:146:in
POST' C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/methodoverride.rb:15:in call’
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/params_parser.rb:15:in
call' C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/session/cookie_store.rb:99:in call’
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/failsafe.rb:26:in
call' C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in call’
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:114:in
call' C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/reloader.rb:34:in run’
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:108:in
call' C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/rails/rack/static.rb:31:in call’
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/urlmap.rb:49:in
call' C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/urlmap.rb:41:in each’
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/urlmap.rb:41:in
call' C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/rails/rack/log_tailer.rb:17:in call’
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/content_length.rb:13:in
call' C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/chunked.rb:15:in call’
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/handler/mongrel.rb:67:in
process' C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:159:in process_client’
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:158:in
each' C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:158:in process_client’
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:285:in
run' C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:285:in initialize’
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:285:in
new' C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:285:in run’
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:268:in
initialize' C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:268:in new’
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:268:in
run' C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/handler/mongrel.rb:38:in run’
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/commands/server.rb:111
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/commands/server.rb:31:in
require' C:/jruby/jruby-1.5.0/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in require’
./script/server:3
./script/server:2:in `load’
-e:2

How to solve this problem? Please help!

this line of the tutorial could be outdated

has_attached_file :photo, :path =>
“:rails_root/public/:class/:attachment/:id/:style_:basename.:extension”

see paperclip’s documention to see if is still valid

I already check with there website, has_attached_file is still valid.

sorry i meant you should check that you can still pass

“:rails_root/public/:class/:attachment/:id/:style_:basename.:extension”

instead of

Rails.root.join

Radhames Brito wrote in post #995446:

sorry i meant you should check that you can still pass

“:rails_root/public/:class/:attachment/:id/:style_:basename.:extension”

instead of

Rails.root.join

Thank you for your response. I checked as you told me and I found that
it pass to
“:rails_root/public/system/:attachment/:id/:style/:filename”.

But I don’t understand how can I setup this path.
Please explain to me :slight_smile:

But I think it should store in defualt path, doesn’t it?
The defaul path is
“:rails_root/public/:attachment/:id/:style/:basename.:extension”

Which the file which I attach should be appeared under public folder.
That means no need to set any thing because public folder is already
existed under root project.
What do you think?

please try passing this path and url, since i see you are storing
directly in under the public directory

:url => “/system/images/:id/:style/:basename.:extension”,
:path =>
“:rails_root/public/system/images/:id/:style/:basename.:extension”

just in case.

what is raising the exception is utils.rb which is a file system
utility for ruby is not parth of the rails framework, mainly your
problem is that utils.rb cant find thet path you have set as the
storage path.

On Fri, Apr 29, 2011 at 5:51 AM, Sira PS [email protected] wrote:

But I think it should store in defualt path, doesn’t it?
The defaul path is
:rails_root/public/:attachment/:id/:style/:basename.:extension

Which the file which I attach should be appeared under public folder.
That means no need to set any thing because public folder is already
existed under root project.
What do you think?

When you deploy , if you use capistrano you need to put it under
public/system/
or the images will have to be under your source control, which is not
practical. That is, if you use capistrano. Anyway i just want you to try
a
different path.