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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:46:04+00:00 2026-05-20T15:46:04+00:00

[update: by not using rake routes , just to understand Rails console a little

  • 0

[update: by not using rake routes, just to understand Rails console a little more]

It seems like inside of “rails console” for Rails 3, we can use controller, but in Rails 2.2 or 2.3, we need to use @controller

And in Rails 3, we can print out all the routes added by Rails routing for a scaffold foo:

ruby-1.9.2-p0 > puts controller.public_methods.grep(/path|url/).grep(/foo/).sort.join("\n")
edit_foo_path
edit_foo_url
foo_path
foo_url
foos_path
foos_url
new_foo_path
new_foo_url

but on Rails 2.3.8, it gives a bunch of formatted_foos_path, etc, and gives nothing for Rails 2.2.2. How to make it print out for Rails 2.3.8 and 2.2.2?


Details for Rails 2.3.8:

ruby-1.8.7-p302 > puts @controller.public_methods.grep(/path|url/).grep(/foo/).sort.join("\n")
formatted_edit_foo_path
formatted_edit_foo_url
formatted_foo_path
formatted_foo_url
formatted_foos_path
formatted_foos_url
formatted_new_foo_path
formatted_new_foo_url
  • 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-20T15:46:05+00:00Added an answer on May 20, 2026 at 3:46 pm

    Rails 3.x–6.x

    Rails.application.routes.named_routes.helper_names
    

    Rails 2.x

    helpers = Rails.application.routes.named_routes.helpers
    

    This will get you all the named route methods that were created. Then you can do helpers.map(&:to_s), and whatever regex you want to get your foo versions

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

Sidebar

Related Questions

( Updated a little ) I'm not very experienced with internationalization using PHP, it
By default the session expiry seems to be 20 minutes. Update: I do not
Update : Looks like the query does not throw any timeout. The connection is
I was using prototype with Rails 3 but i converted to jquery using: rake
e.g, foo1 foo2 foo10 foo100 rather than foo1 foo10 foo100 foo2 Update: not interested
Duplicate of this question . update - This is not an exact duplicate. See
I have to update old projects at work. I do not have any experience
I noticed today that in D2009 (with update 1), TStringStream.ReadString does not move the
Update: giving a much more thorough example. The first two solutions offered were right
Update : This gem DOES install with sudo rake gems:install. The problem is with

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.