Topic: Rails3 + paperclip / redirect after save driving me crazy!!!

Hi,

Need some help please (urgent).

I have basic Rails3 scaffolding => Post + paperclip.
Nothing fancy, on dev machine everything works as expected, but on production box after upload/save 'something' changes redirect route.
I havent touched controller, route is ok (resources :posts), view is ok (<%= form_for @post, :html => {:multipart => true} do |f| %>), Gemfile ok. Well, everything seems to be ok, but something doesnt work. After paperclip save redirect should be /posts/18 not /posts/posts/18 !!!???

****This is production log:

Started POST "/posts/posts" for IPxxx at Sun Dec 12 20:48:38 +0100 2010
  Processing by PostsController#create as HTML
  Parameters: {"commit"=>"Create Post", "post"=>{"photo"=>#<File:/tmp/RackMultipart20101212-26934-apbosx-0>}, "authenticity_token"=>"64aovTQGXJb8znc9747DoC2PDzkBuhLAWcQjTYu9nzQ=", "utf8"=>"✓"}
[paperclip] Saving attachments.
[paperclip] saving /home/policlin/rails_apps/papercliptest/public/assets/photos/18_thumb_contact.jpg
[paperclip] saving /home/policlin/rails_apps/papercliptest/public/assets/photos/18_small_contact.jpg
[paperclip] saving /home/policlin/rails_apps/papercliptest/public/assets/photos/18_medium_contact.jpg
[paperclip] saving /home/policlin/rails_apps/papercliptest/public/assets/photos/18_col6_contact.jpg
[paperclip] saving /home/policlin/rails_apps/papercliptest/public/assets/photos/18_col3_contact.jpg
[paperclip] saving /home/policlin/rails_apps/papercliptest/public/assets/photos/18_original_contact.jpg
Redirected to http://www.000000000.com/posts/posts/18
Completed 302 Found in 952ms


Started GET "/posts/posts/18" for IP at Sun Dec 12 20:48:39 +0100 2010

ActionController::RoutingError (No route matches "/posts/posts/18"): ????????

**** This is controller's create action:
  def create
    @post = Post.new(params[:post])

    respond_to do |format|
      if @post.save
        format.html { redirect_to(@post, :notice => 'Post was successfully created.') }
        format.xml  { render :xml => @post, :status => :created, :location => @post }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @post.errors, :status => :unprocessable_entity }
      end
    end
  end


Hosted on Linux / Ruby 1.8.7 / Rails 3.0.0 / Passenger

Anybody????


Tnx in advance,
Dean

Last edited by dean (2010-12-12 18:10:16)

Re: Rails3 + paperclip / redirect after save driving me crazy!!!

Hi.
Did you solve your problem?
I'm having trouble with the same thing.

My app is multilanguageal and I'm getting double language segment in URL.
Happens only when using Paperclip.

Thanks.

Re: Rails3 + paperclip / redirect after save driving me crazy!!!

Hey,

Problem was apache's mod_security module. If it's turned off everything works fine.

D.

Re: Rails3 + paperclip / redirect after save driving me crazy!!!

I'll inform my hosting service emmediatly.
Thanks.