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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:18:58+00:00 2026-05-15T12:18:58+00:00

I appreciate this is an incredibly noob question, but having Googled multiple combinations of

  • 0

I appreciate this is an incredibly noob question, but having Googled multiple combinations of search terms I regretfully am still in the dark. These things can be difficult when one doesn’t know and so obvious when one does.

I have semi-home page where incoming customers can choose to see a queried list or do a handful of other things. This isn’t a home page but a sort of mini ‘switchboard’ within the site.

The seven standard RESTful Rails controller methods are (as I understand them):

List # shows a list of records generated with .find(:all)
Show # shows details on one record
New # initiates new record
Create # saves and renders/redirects
Edit # finds and opens existing record for edit
Update # updates attributes
Delete # deletes record
  1. What to use when some users need to see a selected ‘list’ of records that isn’t literally .find(:all)? How would this work given I still need a list function that gives me .find(:all) for other purposes?
  2. I’ve heard of ‘index’ being used in Rails controllers, but I don’t know the difference between index and list.
  3. For best practice and best design, what controller methods would you use for a mini-switchboard (and other intermediate pages such as ‘About Us’)?

Any specific answers would be a bit more useful than links to http://guides.rubyonrails.org/action_controller_overview.html etc. 🙂 Thanks very much.

  • 1 1 Answer
  • 3 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-15T12:18:59+00:00Added an answer on May 15, 2026 at 12:18 pm

    First, I think it’s important to note that the “standard methods” are neither standard nor methods in a sense. These are considered actions, and are only standard in that they are the conventions used with scaffolding. You can create any number of actions and group them logically with a controller.

    If you open up [Project]/config/routes.rb and read through the comments, I think you’ll understand a little better how controllers and actions map to a specific route. For instance, you can create a named route to the login controller’s login action and call it authenticate by adding to the top of your routes.rb:

    # ex: http://localhost/authenticate
    map.authenticate 'authenticate', :controller => 'login', :action => 'login'
    # map.[route] '[pattern]', :controller => '[controller]', :action => '[action]'
    
    #  ex: http://localhost/category/1
    map.category 'category/:id', :controller => 'categories', :action => 'list'
    
    # ex: http://localhost/product_group/electronics
    map.search 'product_group/:search', :controller => 'products', :action => 'list'
    

    To partially answer your question, you may want to consider adding a category model and associating all products to a category. then, you can add a named route to view items by category as in the code block above.

    The major benefit to using named routes is that you can call them in your views as category_url or category_path. Most people don’t want to do this and rely on the default route mappings (at the end of the routes.rb):

     # ex: http://localhost/category/view/1
     map.connect ':controller/:action/:id'
    
     # ex: http://localhost/category/view/1.xml
     # ex: http://localhost/category/view/1.json
     map.connect ':controller/:action/:id.:format'
    

    The key thing to mention here is that when a URI matches a route, the parameter that matches against a symbol (:id, or :search) is passed into the params hash. For instance, the search named route above would match a search term into params[:search], so if your products have a string column called ‘type’ that you plan to search against, your products controller might look like:

    class Products < ApplicationController
      def list
        search_term = params[:search]
        @products = Product.find(:all, :conditions => ["type = ?", search_term])
      end
    end
    

    Then, the view [Project]/app/views/products/list.html.erb will have direct access to @products

    If you’d really like an in-depth view into Ruby on Rails (one that is probably 10 times easier to follow than the guide in the link that you posted) you should check out
    Agile Web Development with Rails: Second Edition, 2nd Edition

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

Sidebar

Related Questions

I appreciate this question is a little silly, so I apologise in advance if
I'd really appreciate an answer to this, but can't afford a bounty (!). Here
I'm sure this is incredibly simple for somebody, but I am failing to grasp
I apologize in advance if this is an incredibly dumb question... Currently I have
I'm an erlang newbie so I apologize if this question is incredibly dumb. I'm
I appreciate this may be a case of running before I can walk and
(Let me begin by saying that a) I appreciate this is the wrong place
I will really appreciate help for this. My html v2 file with some temporary
I am new to writing SQL and would greatly appreciate help on this problem.
Note: I'd appreciate some tag suggestions for this one.. I'd like to provide my

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.