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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:47:14+00:00 2026-06-01T21:47:14+00:00

I have a Article object with nested attributes Property. Now I want to print

  • 0

I have a Article object with nested attributes Property.
Now I want to print it at the front in show.html.erb

I can print all attributes, but at the I get at the end an ouput that looks like a map with all objects inside. What am I doing wrong?

show.html.erb

<p>
  <%= @article.properties.each do |property| %>
      <li>
      <b><%= property.name %></b> <%= property.value %>
      </li>
  <% end %>
</p>

article.rb

class Article < ActiveRecord::Base
  has_many :properties
  accepts_nested_attributes_for :properties 
end

and the wrong html output in the browser

Property_6588 Value_6588
Property_9390 Value_9390
Property_15367 Value_15367
Property_19710 Value_19710
[#<Property id: 6588, name: "Property_6588", value: "Value_6588", article_id: 4766, created_at: "2012-04-12 13:33:23", updated_at: "2012-04-12 13:33:23">, #<Property id: 9390, name: "Property_9390", value: "Value_9390", article_id: 4766, created_at: "2012-04-12 13:33:29", updated_at: "2012-04-12 13:33:29">, #<Property id: 15367, name: "Property_15367", value: "Value_15367", article_id: 4766, created_at: "2012-04-12 13:33:41", updated_at: "2012-04-12 13:33:41">, #<Property id: 19710, name: "Property_19710", value: "Value_19710", article_id: 4766, created_at: "2012-04-12 13:33:50", updated_at: "2012-04-12 13:33:50">]
  • 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-01T21:47:16+00:00Added an answer on June 1, 2026 at 9:47 pm

    change

    <%= @article.properties.each do |property| %>
    

    to

    <% @article.properties.each do |property| %>
    

    The = sign renders the following statement, in this case the collection you’re iterating through.

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

Sidebar

Related Questions

I'm trying to upload files for an article model. Since an object can have
Suppose I have an entity object defined as public partial class Article { public
I have some nested models in my Rails application. i have an article hat
I have followed this article and implemented my service and I can open the
I have an Article object with the following properties: Article Name (varchar) Article Body
If I have an article with all the og: meta tags, how do I
I want to implement an apperance as this article mentioned using nested ListView control.
I have a following javascript that I call from my _form.html.erb. $.ajax({ type: GET,
I have this variable: {{ object.article.rating.get_percent|floatformat }} that outputs this: 540787 Is there a
I have a Tag and an Article object with a many-to-many relationship using Entity

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.