Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3420642
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:02:03+00:00 2026-05-18T06:02:03+00:00

So I ran a regular generate scaffold and used a stock form to handle

  • 0

So I ran a regular generate scaffold and used a stock form to handle uploads.

All uploads work nicely and the image is attached perfectly. The issue I get is when I go to ‘Edit’ and try to change the image, this is the error I get:

Routing Error

No route matches "/uploads"

Here is what my controller looks like. The name is ‘uploads_controller.rb’

class UploadsController < ApplicationController
  # GET /uploads
  # GET /uploads.xml
  def index
    @uploads = Upload.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @uploads }
    end
  end

  # GET /uploads/1
  # GET /uploads/1.xml
  def show
    @upload = Upload.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @upload }
    end
  end

  # GET /uploads/new
  # GET /uploads/new.xml
  def new
    @upload = Upload.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @upload }
    end
  end

  # GET /uploads/1/edit
  def edit
    @upload = Upload.find(params[:id])
  end

  # POST /uploads
  # POST /uploads.xml
  def create
    @upload = Upload.new(params[:upload])

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

  # PUT /uploads/1
  # PUT /uploads/1.xml
  def update
    @upload = Upload.find(params[:id])

    respond_to do |format|
      if @upload.update_attributes(params[:upload])
        format.html { redirect_to(@upload, :notice => 'Upload was successfully updated.') }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @upload.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /uploads/1
  # DELETE /uploads/1.xml
  def destroy
    @upload = Upload.find(params[:id])
    @upload.destroy

    respond_to do |format|
      format.html { redirect_to(uploads_url) }
      format.xml  { head :ok }
    end
  end
end

The ‘upload.rb’ model file looks like this:

class Upload < ActiveRecord::Base
    has_attached_file :image
end

show.html.erb

<p id="notice"><%= notice %></p>

<p>
  <b>Name:</b>
  <%= @upload.name %>
</p>

<p>
  <b>Description:</b>
  <%= @upload.description %>
</p>

<p>
  <b>Your Image:</b>
  <%= image_tag @upload.image.url %>
</p>

<%= link_to 'Edit', edit_upload_path(@upload) %> |
<%= link_to 'Back', uploads_path %>

edit.html.erb

<h1>Editing upload</h1>

<%= render 'form' %>

<%= link_to 'Show', @upload %> |
<%= link_to 'Back', uploads_path %>

_form.html.erb

<%= form_for (@upload), :url => uploads_path, :html => { :multipart => true } do |f| %>
  <% if @upload.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@upload.errors.count, "error") %> prohibited this upload from being saved:</h2>

      <ul>
      <% @upload.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <div class="field">
    <%= f.label :name %><br />
    <%= f.text_field :name %>
  </div>
  <div class="field">
    <%= f.label :description %><br />
    <%= f.text_field :description %>
  </div>
  <div class="field">
    <%= f.file_field :image %>
  </div>  
  <div class="actions">
    <%= f.submit %>
  </div>
<% end %>

Thanks.

Edit: Relevant part of the ‘rake routes’ output:

 uploads GET    /uploads(.:format)          {:action=>"index", :controller=>"uploads"}
        uploads POST   /uploads(.:format)          {:action=>"create", :controller=>"uploads"}
     new_upload GET    /uploads/new(.:format)      {:action=>"new", :controller=>"uploads"}
    edit_upload GET    /uploads/:id/edit(.:format) {:action=>"edit", :controller=>"uploads"}
         upload GET    /uploads/:id(.:format)      {:action=>"show", :controller=>"uploads"}
         upload PUT    /uploads/:id(.:format)      {:action=>"update", :controller=>"uploads"}
         upload DELETE /uploads/:id(.:format)      {:action=>"destroy", :controller=>"uploads"}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T06:02:04+00:00Added an answer on May 18, 2026 at 6:02 am

    So it seems the error was in my _form partial.

    I had a :url attribute defined, when I shouldn’t have.

    Paperclip needs to update their install instructions to reflect that change for Rails 3.

    The wonderful guys in #RubyOnRails on irc.freenode.net helped me out with this one.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I ran across some code recently at work (recreated to be similar to what
Possible Duplicate: Reversing a regular expression in python I think I ran into a
I am new to both Perl and complicated regular expressions. I mean I've used
I have just a regular UITableView, and I ran this code: UITableView *tableView =
I ran Perl::Critic on one of my scripts, and got this message: Regular expression
Here's a problem I ran into recently. I have attributes strings of the form
Executive Summary: preg_replace() ran faster than string comparisons. Why? Shouldn't regular expressions be slower?
Ran into an Out of Stack Space error trying to serialize an ASP.Net AJAX
Ran into something interesting, want to know if I'm doing something wrong or if
Ran into this error message while trying to select some records off a table.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.