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 6145875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:51:41+00:00 2026-05-23T18:51:41+00:00

Started building an application here. client and server style architecture sending active resources across

  • 0

Started building an application here. client and server style architecture sending active resources across the wire and storing as activeRecord server side. Managed to get it up and running with a nice example in an O Reilly book except its using scaffold.

Rails routing – custom routes for Resources
is using map.resources from rails 2-
I’m using rails 3 so Its not really applicable and while I did post a question about routes from 2 to 3, I still cant convert this.

So here whats im looking at:

Rake routes with

resources :user_requests

gives:

    user_requests GET    /user_requests(.:format)          {:controller=>"user_requests", :action=>"index"}
                  POST   /user_requests(.:format)          {:controller=>"user_requests", :action=>"create"}
 new_user_request GET    /user_requests/new(.:format)      {:controller=>"user_requests", :action=>"new"}
edit_user_request GET    /user_requests/:id/edit(.:format) {:controller=>"user_requests", :action=>"edit"}
     user_request GET    /user_requests/:id(.:format)      {:controller=>"user_requests", :action=>"show"}
                  PUT    /user_requests/:id(.:format)      {:controller=>"user_requests", :action=>"update"}
                  DELETE /user_requests/:id(.:format)      {:controller=>"user_requests", :action=>"destroy"}

I’d like to remove this and the resources and have my own routes pointing to my own defs.

Heres a quick attempt

  match '/user_requests(.:format)' => 'user_requests#create , :via =>:post' 
  match '/user_requests/:id(.:format)' =>"user_requests#show"

returns almost the exact same as above

/user_requests(.:format)          {:controller=>"user_requests", :action=>"create"}
/user_requests/:id(.:format)      {:controller=>"user_requests", :action=>"show"}

With the exception of the REST nouns at the start and the links. Its the same yet my own routes dont work.
What do I need to add to my routes to make them do the same thing as resources?

I’m not keeping scaffold as I’ve been told its never used in the real world. And I will be changing the names of my defs, but one step at a time.

Error that server shows:

Started POST "/user_requests.xml" for 127.0.0.1 at Tue Jul 12 17:13:32 +0100 2011
  Processing by UserRequestsController#create as XML
  Parameters: {"method"=>"POST", "user_request"=>{"depth"=>3000000, "url"=>"www.stackoverflow.com"}}
  SQL (0.1ms)  SELECT 1 FROM "user_requests" WHERE ("user_requests"."url" = 'www.stackoverflow.com') LIMIT 1
  AREL (0.3ms)  INSERT INTO "user_requests" ("updated_at", "depth", "url", "created_at") VALUES ('2011-07-12 16:13:32.765392', 3000000, 'www.stackoverflow.com', '2011-07-12 16:13:32.765392')
Completed 404 Not Found in 17ms

ActionController::RoutingError (No route matches {:controller=>"user_requests", :id=>#<UserRequest id: 6, url: "www.stackoverflow.com", depth: 3000000, created_at: "2011-07-12 16:13:32", updated_at: "2011-07-12 16:13:32">, :action=>"show"}):
  app/controllers/user_requests_controller.rb:19:in `create'
  app/controllers/user_requests_controller.rb:16:in `create'

Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.0.9/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.8ms)
  • 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-23T18:51:42+00:00Added an answer on May 23, 2026 at 6:51 pm

    It would guess that line 19 of your UserRequestsController has something like

    redirect_to @user_request
    

    which tries to guess a URL for showing a UserRequest object. Rails no longer knows how to do this; you’ve lost the helper methods generated by resources (such as user_request_path, new_user_request_path, etc).

    You can tell Rails to generate the “show” helper method by adding a :as option to your show route, without the _path postfix:

     match '/user_requests/:id(.:format)' => "user_requests#show", :as => 'user_request'
    

    You’ll now have access to a user_request_path and user_request_url, which Rails can use to find the URL to “show” a UserRequest.

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

Sidebar

Related Questions

I've just started building a prototype application in Django. I started out by working
I recently started building a console version of a web application. I copied my
I'm getting started on building a REST API for a project I'm working on,
I started an application in Google App Engine right when it came out, to
Didnt really consider this aspect till I started building my solution... To simplify, my
Unlike this question: Linker Error while building application using Boost Asio in Visual Studio
I am building php web application that let's a user upload a MS Access
I am building a Asp.net Application. I need to save a HashTable in a
I'm working on a Java EE 6 application. When I started out, I was
I started trying to play with Mono, mostly for fun at the moment. I

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.