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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:02:45+00:00 2026-05-10T23:02:45+00:00

My homepage (or welcome page) will consist of data from two models (lets call

  • 0

My homepage (or welcome page) will consist of data from two models (lets call them authors and posts). I am new to rails and not sure what is the best way to accomplish this.

Should I create a new controller called welcome which gathers data from the authors and posts and then display them in the welcome index view? Or should I have a welcome view under the post model which also gets data from authors? Or any other way to accomplish this?

I understand how to do all this technically but just unsure what is the best practice method using the rails framework.

  • 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. 2026-05-10T23:02:45+00:00Added an answer on May 10, 2026 at 11:02 pm

    The question is, is your home page just a landing page or will it be a group of pages? If it’s just a landing page, you don’t expect your users to hang around there for long except to go elsewhere. If it’s a group of pages, or similar to an existing group, you can add an action to the controller it’s most like.

    What I’ve done for my current project is make a controller named Static, because I need 3 static pages. The home page is one of these, because there isn’t anything to see or do except go elsewhere.

    To map a default route, use the following in routes.rb:

    # Place at the end of the routing! map.root :controller => 'MyController', :action => :index 

    In my case this would be:

    map.root :controller => 'static', :action => :index 

    If you wish to, you could create a controller just for this home page. I’d call it main, or something that you can remember which relates to the home page. From there you can get your data and your models and defer to the output view.

    class MainController < ApplicationController   def index     @posts = Posts.find(:all, :limit => 10, :order => 'date_posted', :include => :user)   end end 

    Assuming you have your model relationships defined correctly, the template to match it will be very simple.

    Good luck, hope this helps.

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

Sidebar

Related Questions

On my homepage I have a loop of posts that uses infinite scroll. A
I read the manual from the php homepage It writes: // this doesn't go
Notice while on Google's homepage, with no focus on any element, pressing BACKSPACE will
Generally, welcome file lists are used to show first page of application. What if,
can you please let me know what I am missing: <html> <head><title>page</title></head> <body> <h2><center>Welcome
I' using Symfony2.1 and I want to do something like this: Welcome page before
I have a welcome page (JSP file) for my application that contains some dynamic
I am trying to open a link on my page in a new page
in my web.xml i want to read the welcome file from property file something
On google homepage, if you click the more button, a menu opens below just

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.