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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:29:39+00:00 2026-05-13T11:29:39+00:00

My link_to and url_for etc. methods are generating paths in the pattern of :controller/:id/:action,

  • 0

My “link_to” and “url_for” etc. methods are generating paths in the pattern of “:controller/:id/:action”, instead of “:controller/:action:/:id” – in other words my “action” and “id” fields in the url are getting swapped.

I’ve narrowed it down to these generated links through doing some route debugging, however, I don’t quite understand how the routes.rb file can say one thing, but the generated routes can be in a different order. Is there something more to this than the routes file alone?

*In case it matters, I’m also using authlogic to do my user authentication.

Here’s my routes.rb file, with the comments removed.

map.resources :tags
map.resources :ratings
map.resources :users
map.resources :bids
map.resources :listings
map.resource :user_session
map.root :controller => "user_sessions", :action => "new"
map.resource :account, :controller => "users"
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'

Thanks!

  • 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-13T11:29:39+00:00Added an answer on May 13, 2026 at 11:29 am

    Uh…I might have solved my problem, though I don’t know how.

    The URLs still seem wrong to me, clicking on the “Show”, “Edit” or “Destroy” links used to take me to an error page where I’d get a nil reference error due to the funky routes.

    I just did a “rake db:migrate:redo STEP=3” after making a small change to one of my previous migrations, restarting the web server, and now the app navigates without error.

    What I still don’t understand though, is that the generated links are still “:controller/:id/:action”, but it’s suddenly it’s decoding properly.

    Very confused.

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

Sidebar

Related Questions

I want to embed a link to a controller action in my page so
User click on a link button and it will direct them to a url
First off if you're unaware, samba or smb == Windows file sharing, \\computer\share etc.
I've got model with many associations. User :has_many => :posts, :videos, :images etc I've
For example on my site i got links to twitter,facebook etc. and the link
I haven't touched any code in a good 4-5 months so just getting back
I'm coding a core javascript object for my site, building in the common methods
Am stumbled - went through docs, tutorials, etc, and am not sure what I
I want to link to bookmark on a page (mysite.com/mypage.htm#bookmark) AND visually highlight the
I want to link to a page which contains multiple support topics. When the

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.