hello, i implementing a file upload using paperclip plugin. i getting the following error [1] when uploading a file. I''m using the gems rails v2.3.8 and paperclip v2.1.6. the parameter hash looks like [2], the model like [3]. Interesting is that i get two different errors, on the localhost with webrick it says: Status: 500 Internal Server Error no marshal_dump is defined for class Proc /var/lib/gems/1.8/gems/activesupport-2.3.8/lib/active_support/ message_verifier.rb:38:in `dump'' on the server (same setup): Status: 500 Internal Server Error can''t dump File /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/ message_verifier.rb:38:in `dump'' any hints? thx [2] Processing UploadItemController#create (for 84.119.78.19 at 2011-06-01 11:42:48) [POST] Parameters: {"commit"=>"Upload", "action"=>"create", "authenticity_token"=>"o5Dbbzd0CA45UpNQ++mQw5gQtoUkmbBT2UEP3FuPAbM=", "controller"=>"upload_item", "upload_item"=>{"title"=>"dddd", "upload"=>#<File:/tmp/RackMultipart7503-0>, "upload_rules"=>"0", "description"=>"dsf"}} Redirected to http://ichsehichseh.wirdorange.org/upload_items/new Completed in 298ms (DB: 26) | 302 Found [http:// ichsehichseh.wirdorange.org/upload_items] [1] /!\ FAILSAFE /!\ Wed Jun 01 11:42:48 +0200 2011 Status: 500 Internal Server Error can''t dump File /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/ message_verifier.rb:38:in `dump'' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/ message_verifier.rb:38:in `generate'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/ session/cookie_store.rb:157:in `marshal'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/ session/cookie_store.rb:106:in `call'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/ failsafe.rb:26:in `call'' /usr/lib/ruby/1.8/rack/lock.rb:11:in `call'' /usr/lib/ruby/1.8/rack/lock.rb:11:in `synchronize'' /usr/lib/ruby/1.8/rack/lock.rb:11:in `call'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/ dispatcher.rb:106:in `call'' /usr/lib/ruby/1.8/phusion_passenger/rack/request_handler.rb:92:in `process_request'' /usr/lib/ruby/1.8/phusion_passenger/abstract_request_handler.rb: 207:in `main_loop'' /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb: 441:in `start_request_handler'' /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb: 381:in `handle_spawn_application'' /usr/lib/ruby/1.8/phusion_passenger/utils.rb:252:in `safe_fork'' /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb: 377:in `handle_spawn_application'' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__'' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop'' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously'' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:163:in `start'' /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb: 222:in `start'' /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:253:in `spawn_rails_application'' /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb: 126:in `lookup_or_add'' /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:247:in `spawn_rails_application'' /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb: 80:in `synchronize'' /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb: 79:in `synchronize'' /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:246:in `spawn_rails_application'' /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:145:in `spawn_application'' /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:278:in `handle_spawn_application'' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__'' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop'' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously'' /usr/lib/phusion_passenger/passenger-spawn-server:61 [3] has_attached_file :upload, :styles => { :thumb => { :geometry => "200x200>", :format => :png }}, :whiny => false validates_attachment_content_type :upload, :content_type => [''image/jpeg'', ''image/png'', ''image/gif'', ''image/pjpeg'', ''image/x-png'', ''image/jpeg2000'', ''application/pdf''], :message => ''Uploaded file is not an image nor pdf'' -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Jun 1, 10:51 am, PeterI <p...-2anF5v0VQHHQT0dZR+AlfA@public.gmane.org> wrote:> hello, > > i implementing a file upload using paperclip plugin. i getting the > following error [1] when uploading a file. I''m using the gems rails > v2.3.8 and paperclip v2.1.6. the parameter hash looks like [2], the > model like [3]. >> Interesting is that i get two different errors, on the localhost with > webrick it says: > > Status: 500 Internal Server Error > no marshal_dump is defined for class Proc > /var/lib/gems/1.8/gems/activesupport-2.3.8/lib/active_support/ > message_verifier.rb:38:in `dump'' > > on the server (same setup): > > Status: 500 Internal Server Error > can''t dump File > /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/ > message_verifier.rb:38:in `dump'' > > any hints? > thxThis sounds like your controller is putting something in the session which can''t be serialized (such as a file or proc object) Fred> > [2] Processing UploadItemController#create (for 84.119.78.19 at > 2011-06-01 11:42:48) [POST] > Parameters: {"commit"=>"Upload", "action"=>"create", > "authenticity_token"=>"o5Dbbzd0CA45UpNQ++mQw5gQtoUkmbBT2UEP3FuPAbM=", > "controller"=>"upload_item", "upload_item"=>{"title"=>"dddd", > "upload"=>#<File:/tmp/RackMultipart7503-0>, "upload_rules"=>"0", > "description"=>"dsf"}} > Redirected tohttp://ichsehichseh.wirdorange.org/upload_items/new > Completed in 298ms (DB: 26) | 302 Found [http:// > ichsehichseh.wirdorange.org/upload_items] > > [1] > /!\ FAILSAFE /!\ Wed Jun 01 11:42:48 +0200 2011 > Status: 500 Internal Server Error > can''t dump File > /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/ > message_verifier.rb:38:in `dump'' > /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/ > message_verifier.rb:38:in `generate'' > /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/ > session/cookie_store.rb:157:in `marshal'' > /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/ > session/cookie_store.rb:106:in `call'' > /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/ > failsafe.rb:26:in `call'' > /usr/lib/ruby/1.8/rack/lock.rb:11:in `call'' > /usr/lib/ruby/1.8/rack/lock.rb:11:in `synchronize'' > /usr/lib/ruby/1.8/rack/lock.rb:11:in `call'' > /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/ > dispatcher.rb:106:in `call'' > /usr/lib/ruby/1.8/phusion_passenger/rack/request_handler.rb:92:in > `process_request'' > /usr/lib/ruby/1.8/phusion_passenger/abstract_request_handler.rb: > 207:in `main_loop'' > /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb: > 441:in `start_request_handler'' > /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb: > 381:in `handle_spawn_application'' > /usr/lib/ruby/1.8/phusion_passenger/utils.rb:252:in `safe_fork'' > /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb: > 377:in `handle_spawn_application'' > /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in > `__send__'' > /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in > `main_loop'' > /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in > `start_synchronously'' > /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:163:in > `start'' > /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb: > 222:in `start'' > /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:253:in > `spawn_rails_application'' > /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb: > 126:in `lookup_or_add'' > /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:247:in > `spawn_rails_application'' > /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb: > 80:in `synchronize'' > /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb: > 79:in `synchronize'' > /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:246:in > `spawn_rails_application'' > /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:145:in > `spawn_application'' > /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:278:in > `handle_spawn_application'' > /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in > `__send__'' > /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in > `main_loop'' > /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in > `start_synchronously'' > /usr/lib/phusion_passenger/passenger-spawn-server:61 > > [3] > has_attached_file :upload, > :styles => { :thumb => { :geometry => "200x200>", > :format => :png }}, > :whiny => false > > validates_attachment_content_type :upload, > :content_type => [''image/jpeg'', > ''image/png'', > ''image/gif'', > ''image/pjpeg'', > ''image/x-png'', > ''image/jpeg2000'', > ''application/pdf''], :message > => ''Uploaded file is not an image nor pdf''-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
thanx for the answer. but how can i prevent the controller from doing so? peter -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Jun 1, 2:49 pm, PeterI <p...-2anF5v0VQHHQT0dZR+AlfA@public.gmane.org> wrote:> thanx for the answer. > > but how can i prevent the controller from doing so? >Well that depends on what it''s doing in the first place. If you post the relevant controller code someone might be able to help. If it''s not in the action itself, look for any before/after filters that might be running. It might also be worth adding some code to print what is in the session - it might give you some clue as to what is putting it there Fred -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
hi, thanks a lot for your answer! the application is very simple. user registration with authlogic and file upload. [1] shows the FileUploadController. Authlogic creates a session object. a before filter looks if the user is logged in. [2] shows the UserSessionController. I dont think its authlogic that dumps the file into the session, because i got the error since i tryed to implement a file upload (before i added user registration), and i got the same error from attachment_fu plugin. by the way the application is hosted on github:https://github.com/peonic/ichsehichseh is there a way to disable session store for a Controller. thx [1] class UploadItemController < ApplicationController before_filter :require_user def new @user = current_user @upload_item = UploadItem.new() @story = @user.story.first end def create @upload_item = UploadItem.new(params[:upload_item]) @upload_item.story = current_user.story.first if @upload_item.save flash[:notice] = "Upload completed" redirect_to user_url(current_user) else flash[:error] = @upload_item.errors render :action => new end end end [2] class UserSessionsController < ApplicationController before_filter :require_no_user, :only => [:new, :create] before_filter :require_user, :only => :destroy def new @user_session = UserSession.new end def create @user_session = UserSession.new(params[:user_session]) if @user_session.save flash[:notice] = "Erfolgreich Eingeloggt" redirect_to user_url(@user_session) else render :action => :new end end def destroy current_user_session.destroy redirect_to new_user_session_url end -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Jun 2, 4:05 pm, PeterI <p...-2anF5v0VQHHQT0dZR+AlfA@public.gmane.org> wrote:> hi, thanks a lot for your answer! > > the application is very simple. user registration with authlogic and > file upload. [1] shows the FileUploadController. Authlogic creates a > session object. a before filter looks if the user is logged in. [2] > shows the UserSessionController. > > I dont think its authlogic that dumps the file into the session, > because i got the error since i tryed to implement a file upload > (before i added user registration), and i got the same error from > attachment_fu plugin. by the way the application is hosted on > github:https://github.com/peonic/ichsehichsehWeird. The only thing I can think of is to stick a breakpoint where the exception is raised: if you can see what the offending object is, that might give you a clue Fred> is there a way to disable session store for a Controller. > thx > > [1] > class UploadItemController < ApplicationController > before_filter :require_user > > def new > @user = current_user > @upload_item = UploadItem.new() > @story = @user.story.first > end > > def create > @upload_item = UploadItem.new(params[:upload_item]) > @upload_item.story = current_user.story.first > > if @upload_item.save > flash[:notice] = "Upload completed" > redirect_to user_url(current_user) > else > flash[:error] = @upload_item.errors > render :action => new > end > end > end > > [2] > class UserSessionsController < ApplicationController > before_filter :require_no_user, :only => [:new, :create] > before_filter :require_user, :only => :destroy > > def new > @user_session = UserSession.new > end > > def create > @user_session = UserSession.new(params[:user_session]) > if @user_session.save > flash[:notice] = "Erfolgreich Eingeloggt" > redirect_to user_url(@user_session) > else > render :action => :new > end > end > > def destroy > current_user_session.destroy > redirect_to new_user_session_url > end-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I had the same error .. ( see my recent post ... http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/7e989c24581115a3/0812ebc44c574c17?hl=en&lnk=gst&q=can%27t+dump#0812ebc44c574c17 ) I solved the issue by clearing out the tempfile created..... ====== quote =====Hi David I was re-running my test to output the trace , but I tested again another trick ... by trying to delete directly the upload tempfile attribute of the ActionDispatch::Http::UploadedFile created instance before the redirect_to ... params[:clip][:data].tempfile = nil redirect_to ... and it''s running ... so params[:clip][:data] = nil or params[:clip] = nil is not enough .. On Jun 2, 4:05 pm, PeterI <p...-2anF5v0VQHHQT0dZR+AlfA@public.gmane.org> wrote:> hi, thanks a lot for your answer! > > the application is very simple. user registration with authlogic andfileupload. [1] shows the FileUploadController. Authlogic creates a > session object. a before filter looks if the user is logged in. [2] > shows the UserSessionController. > > I dont think its authlogic that dumps thefileinto the session, > because i got the error since i tryed to implement afileupload > (before i added user registration), and i got the same error from > attachment_fu plugin. by the way the application is hosted on > github:https://github.com/peonic/ichsehichseh > is there a way to disable session store for a Controller. > thx > > [1] > class UploadItemController < ApplicationController > before_filter :require_user > > def new > @user = current_user > @upload_item = UploadItem.new() > @story = @user.story.first > end > > def create > @upload_item = UploadItem.new(params[:upload_item]) > @upload_item.story = current_user.story.first > > if @upload_item.save > flash[:notice] = "Upload completed" > redirect_to user_url(current_user) > else > flash[:error] = @upload_item.errors > render :action => new > end > end > end > > [2] > class UserSessionsController < ApplicationController > before_filter :require_no_user, :only => [:new, :create] > before_filter :require_user, :only => :destroy > > def new > @user_session = UserSession.new > end > > def create > @user_session = UserSession.new(params[:user_session]) > if @user_session.save > flash[:notice] = "Erfolgreich Eingeloggt" > redirect_to user_url(@user_session) > else > render :action => :new > end > end > > def destroy > current_user_session.destroy > redirect_to new_user_session_url > end-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Problem SOLVED !!! the error was cased in my UploadController when printing the ActiveRecord errors in the flash[:errors]. this made rails dump the hole object (including the file) in the error flash. this is one more reason to use the helper method <%= error_messages_for :my_controller %> instead of displaying it in a flash[:error]> > def create > > @upload_item = UploadItem.new(params[:upload_item]) > > @upload_item.story = current_user.story.first > > > if @upload_item.save > > flash[:notice] = "Upload completed" > > redirect_to user_url(current_user) > > else > > flash[:error] = @upload_item.errors <-- this line caused the error!!! > > render :action => new > > end > > end-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.