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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:31:02+00:00 2026-06-08T00:31:02+00:00

Sorry for a simple question but i am a bit confused trying to follow

  • 0

Sorry for a simple question but i am a bit confused trying to follow ruby on rails tutorial book

I am at the chapter 10 and confused, yes i trick a bit my version for learning purpose
So I have a controller called customer
customers_controller.rb

def show
    @customer = Customer.find(params[:id])
    @posts = @customer.posts
end

I then have the following folder
_post.html.erb

Welcome to a post

Which his called from the show customer file has follow
/view/customer/show.html.erb

<% provide(:title, @customer.name) %>
<aside class="customer_show_nav">
<h1><%= @customer.name %></h1>
<%= @customer.email %>
</aside>

<div class="events">
    <%= render @posts %>
</div>

But when loading nothing his appearing not even Welcome to a post. What i am doing wrong?
Thanks in advance. I am following the tutorial http://ruby.railstutorial.org/chapters/user-microposts#top 10.22

  • 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-08T00:31:03+00:00Added an answer on June 8, 2026 at 12:31 am

    if _post.html.erb is in view/customers

    you do this in view/customers/show.html.erb

    <%= render 'controller_where_post_lives/post' %> which will look for customers/_post.html.erb

    Sometimes, you also need = in <%= %> with rails 3

    Also, show is used to show one item, and index is used to show all items.

    So to render you will do

    <%= render :partial => "post", :collection => @posts %>
    

    Edit:

    When you call render you give it the view, no objects here. Unless like above passing a collection.

    http://guides.rubyonrails.org/layouts_and_rendering.html

    Also if you just want to render text you can do render :text => "OK"

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

Sidebar

Related Questions

Sorry if this is a dead simple question but I'm confused from the documentation
Sorry for this simple question but I am stuck here. I am trying to
Sorry for asking such a simple question but I lost really long time trying
Sorry for probably simple question but I'm a newby in Django and really confused.
Sorry of this appears a bit simple a question, but is there a way
sorry this is such a simple question but I can't figure it out. How
Sorry for this simple question, but I can't solve it... There is an example:
sorry for the dummy question but I cannot find a simple and clean way
I'm sorry to make my first question here a bit of a simple one
Sorry that the question of this problem might be a bit vague. I'm trying

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.