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

  • Home
  • SEARCH
  • 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 582789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:43:28+00:00 2026-05-13T14:43:28+00:00

With Ruby on Rails, REST is a great concept in terms of simplifying things

  • 0

With Ruby on Rails, REST is a great concept in terms of simplifying things for the developer and making resources easy for machines to access, but it also produces phenomenally ugly URLs for humans.

For example, using the popular RESTful Authentication plugin to handle user login and authentication, it creates two controllers for authentication and authorization, users and sessions. This is because user represents the long term resources associated with a user, such as the login and password, while a session represents the login info associated with a login session such as the cookie resources. Thus, the login url for a site would be site.com/sessions/new.

By default, it also creates a route to help this:
map.login ‘/login’, :controller => ‘sessions’, :action => ‘new’

However, this is really only a kludge, because on submit in order for the routes to work right, the form it creates uses <% form_tag session_path do -%>. This causes the post of the form to go to SessionsController#create, but if the form submission fails (such as due to bad credentials) the user’s browser is left at site.com/session, which looks really awkward. Worse yet, if the user manually were to enter that url, it is unavailable unless I define an index method. If I change the form_tag to read <% form_tag login_path do -%> then this results in POSTS to SessionsController#new, which completely messes up the REST.

How can I have consistent and reasonable looking URLs with REST? Overall, I really am tempted by the convenience of using REST, but it seems pretty wrong that this should produce (negative) changes visible to the user.

  • 1 1 Answer
  • 1 View
  • 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-13T14:43:28+00:00Added an answer on May 13, 2026 at 2:43 pm

    I think on the whole REST provides consistent, intuitive and user-friendly URLs, particularly when it comes to retrieving resources (GET) which is usually what a user wants to do (the pages they most often bookmark). Usually, you are dealing with URLs like

    /posts/34
    /articles/456/edit
    /companies
    

    You’ve hit on an isolated (although unavoidable, and therefore very annoying) exception, to which I have never seen a really satisfying solution, other than using AJAX. The problem is that RESTful routes shine in applications that have carefully thought out domains, where the resources on the backend make sense even to the user (like the examples above) whereas session management is inherently obscure to the user.

    If you’re that unhappy with the /sessions URL, why not alias /login/submit to /sessions/create?

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

Sidebar

Related Questions

I am really confused about Ruby on Rails REST routing. Even though I have
Has anyone used Ruby/Rails with a Sales Logix database?
Ruby on Rails does not do multithreaded request-responses very well, or at least, ActiveRecord
Ruby on Rails has magic timestamping fields that are automatically updated when a record
Ruby on Rails has a lot of ways to generate JavaScript. Particularly when it
Ruby on Rails controllers will automatically convert parameters to an array if they have
Within Ruby on Rails applications database.yml is a plain text file that stores database
In Ruby on Rails, I'm attempting to update the innerHTML of a div tag
In Ruby on Rails Development (or MVC in general), what quick rule should I
In Ruby on Rails, how to add foreign key constraint in migration?

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.