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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:00:56+00:00 2026-05-20T10:00:56+00:00

The book Agile development with Rails shows in the second chapter, that you can

  • 0

The book “Agile development with Rails” shows in the second chapter, that you can say:

<%= link_to "Goodbye",say_goodbye_path %>

Instead of hardcoding the path to “/say/goodbye”. Makes sense, I thought to myself. Probably Ruby is splitting the say_goodbye_path by _, assigns the first part as the controller name, the second part as the action name. But, afterwards, I generated the following scaffold:

rails generate scaffold User name:string mail:string

And I noticed in the index.html.erb view, that it had methods like: edit_user_path(user). I tried to rewrite it to user_edit_path(user), but of course, it didn’t work. My question is, why are the scaffold links the other way around? How would I know if I should write them in the way the author uses them in link_to, or in the way they are generated by the scaffold. Can you shed some light on this?

  • 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-20T10:00:57+00:00Added an answer on May 20, 2026 at 10:00 am

    The helper functions like user_edit_path are automatically generated by rails to map operations on resources to the matching routes and thus HTTP paths and HTTP verbs. You have to understand that you are dealing with resources here, not necessarily with simple controllers.

    While most of the time your resources can map to a single controller, it doesn’t have to be that way. You can have nested or combined resources which can result in rather complex routing definitions.

    Resources are typically defined by giving it a name (userin this case) and defining some allowed operations on them. Rails encourages to follow the REST pattern there, so you can have shortcuts to have some operations pre-defined. One of them is edit, which by default matches to a GET request to users_controller#edit. Default operations on RAILS resources are:

    HTTP verb  path          matching controller action
    ===================================================
    GET        /users        #=> index
    GET        /users/1      #=> show
    GET        /users/new    #=> new
    GET        /users/1/edit #=> edit
    PUT        /users/1      #=> update
    POST       /users        #=> create
    DELETE     /users/1      #=> destroy
    

    These mappings can be customized on your routes.rb (changing methods, adding or removing operations, …) Generally you are encouraged to use the default mappings as these are supported by standard helpers and make your app easier to understand.

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

Sidebar

Related Questions

the book says that reintegrated branch should not be used as it can't accept
I am reading a book about Java and it says that you can declare
This book seems really good. Is it still relevant for Scala 2.8, given that
A book that is an introduction to databases and geared towards web developers.
I synced my address book with facebook and can now access my facebook profile
Google Book Search Give Output Something like this Introducing Little Simon&#39;s new Baby Snoopy
I am using a book to study, and am stuck here If you have
I've built an important MySQL database, with a lot of view, triggers, functions and
BOOK_COPIES (Book_ISBN [pk,fk], Branch_ID [pk,fk], Num_Copies) BOOK_LOANS (Book_ISBN [pk,fk], Branch_ID [pk,fk],Card_Num [pk,fk], Date_Out, Date_Due)

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.