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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:37:10+00:00 2026-05-25T17:37:10+00:00

Learning Ruby and Rails. In following the getting started guide if I invoke rails

  • 0

Learning Ruby and Rails. In following the getting started guide if I invoke

rails generate scaffold Post name:string title:string content:text

it generates among other things code like the following in index.html.erb:

<% @posts.each do |post| %>
  <tr>
    <td><%= post.name %></td>
    <td><%= post.title %></td>
    <td><%= post.content %></td>
    <td><%= link_to 'Show', post %></td>
    <td><%= link_to 'Edit', edit_post_path(post) %></td>
    <td><%= link_to 'Destroy', post, confirm: 'Are you sure?', method: :delete %></td>
  </tr>
<% end %>
</table>

My only concern in the above is edit_post_path, and my question is, what is it – and specifically from a Ruby standpoint. It certainly has every appearance of being a Ruby method, and its embedded in other code which is most definitely Ruby: posts.each do |post|...end that’s all Ruby

But if edit_post_path is a Ruby method, where is the code for it? ‘post’ is a label I have provided to Rails, so presumably this Ruby method should be somewhere in my site directory along with other Ruby code generated when invoking “rails generate scaffold…” above (i.e. it wouldn’t be in a Rails-specific directory for example). But there is no such method ‘edit_post_path’ defined anywhere. So is it not really Ruby at all, just something contrived to look that way for some reason, and really just a string of text that is processed by something strictly proprietary to Rails. Is this an example of what is so cool about Rails?

  • 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-25T17:37:10+00:00Added an answer on May 25, 2026 at 5:37 pm

    That is a Rails helper method – aka sugar syntax as James pointed out – for routing within your app.

    To see all the routes available to you, at the command line do rake routes. You will see a list of the helpers on the left, then you will see the HTTP operation in the second column, third column = URL path format, and last column is a breakdown of the controller and action that it relates to.

    To see some of the Ruby code that is at the heart of this magic, check it out in the Rails 3 repo, like this: https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/routing/mapper.rb#L444

    Also if you want to create custom URLs for specific resources, check out: https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/routing/url_for.rb

    Here is some more info on routing in general: http://guides.rubyonrails.org/routing.html

    Hope that helps.

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

Sidebar

Related Questions

I've only just started learning ruby on rails and I would like to create
I am just getting started learning rails. I am building my first app using
I've recently started learning Ruby on Rails, based on RoR3 beta/RC. I had earlier
I have started learning Ruby on Rails and I have been stuck at something
I just started learning ruby on rails with Lynda Ruby on Rails 3 Essential
I'm just learning Ruby on Rails. I've read a few books, I've watched lots
I am learning Ruby on Rails so I'm sure I'll find this out sooner
I am learning Ruby on Rails using a book I picked up called Head
I'm just learning how to program in Ruby on Rails, and I'm really impressed
I am currently in the process of learning Ruby on Rails. I have been

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.