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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T08:24:49+00:00 2026-06-16T08:24:49+00:00

I have the following view in app/views/posts/index.html.erb : <% @posts.each do |post| %> <%=

  • 0

I have the following view in app/views/posts/index.html.erb:

<% @posts.each do |post| %>

<%= post.user %> is listening to <%= post.song %> by <%= post.artist %> from <%= post.album %>

<% end %>

And the corresponding controller:

class PostsController < ApplicationController
  def index
    @posts = Post.find(:all)   
  end

  def show
    @post = Post.find(params[:id])  
  end 

  def new
    @post = Post.new           
  end

  def create                   
    @post = Post.new(params[:posts])
    if @post.save              
      redirect_to action: "index"     
    else                       
      @posts = Post.find(:all) 
      render action: 'new'     
    end
  end
end

The problem is, when I create a record with the song attribute being “The Sound of Settling”, the artist attribute being “Death Cab for Cutie”, and the album atrribute being “Transatlanticism”, nothing shows up when I render the index view.

  • 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-06-16T08:24:50+00:00Added an answer on June 16, 2026 at 8:24 am

    As @house9 and @bdares said, I had :posts in my create action when it should have been :post.

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

Sidebar

Related Questions

I have the following form in my /app/views/password_resets/new.html.erb view <% form_tag password_resets_path do %>
I have the following .erb view in a Sinatra app: <% sessions.each do |session|
I have a form for creating an album like following: # app/views/albums/new.html.erb <h2>Details of
In an MVC3 app, i have the following View: @using (Html.BeginForm(Index, Search, new {query
I have the following view: @model MyModel1 @{ ViewBag.Title = Index; Layout = ~/Views/Shared/_Layout.cshtml;
I have the following code: index.html <HTML> <HEAD> <TITLE>My App</TITLE> <LINK rel=stylesheet type=text/css href=style.css>
In views.py I have the following view which gets called when a new user
I have following view <asp:Content ID=Content2 ContentPlaceHolderID=MainContent runat=server> <h2>Tables <%=ViewData[RetriverName] %></h2> <%using (Html.BeginForm(ResfreshSelectedTables, Home))
I have the following view that allows a user to add a review for
I have following UI hierarchy Scroll View -->TableLayout-->Rows [each row has TextView+EditText] Problem Inside

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.