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

  • Home
  • SEARCH
  • 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 6942913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:05:15+00:00 2026-05-27T13:05:15+00:00

So here is my dilemma. I have created a rails scaffold named posts for

  • 0

So here is my dilemma. I have created a rails scaffold named posts for a blog I am working on. What I want to be able to do is to display posts on the homepage. If anyone has any info or can point me towards a tutorial, I would very much appreciate it.

  • 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-27T13:05:15+00:00Added an answer on May 27, 2026 at 1:05 pm

    In your routes, wherever you have :root pointing to, you can set your posts to @posts in the controller method, then iterate over them in the view. In other words:

    Config/routes.rb

    :root to => "pages#home"
    

    This means your “home page” points to the home method in pages controller. So:

    app/controllers/pages_controller.rb

    def home
      @posts = Post.all
    end
    

    Then in app/views/pages/home.html.erb

    <% @posts.each do |post| %>
      <h1><%= post.title %></h1>
      <%= post.body %>
    <% end %>
    

    Hope this helps!

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

Sidebar

Related Questions

Here is my dilemma. I have a collection of entities that I want to
I have a bit of a dilemma here. I have a drupal 7 database
Here's my dilemma: I have to RGBA RAW images: a master image (the first)
Here's my dilemma: I have two types of routes which are semantically very different,
Here is my dilemma, I am working on some SaaS using ASP.net MVC3 and
Ok, here is my dilemma I have a database set up with about 5
Here is my dilemma: I really like lambda and have been using Boost.Fusion and
Here is my dilemma... I basically have a script which by means of CURL
So here is my dilemma, I have a navigation controller that controls three views.
I have a dilemma. Here is my set-up: ASP.NET/NET 3.5 web application build using

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.