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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:41:16+00:00 2026-06-13T10:41:16+00:00

Newbie question here. I am using mongoid, rails 3.2 and nested_form for my nested

  • 0

Newbie question here. I am using mongoid, rails 3.2 and nested_form for my nested forms.

I have a Profile model that embeds_many :services. I’m using a nested form and have been able to successfully save it to my db. However, I can’t figuer out how to display the embeded documents on my page. This seems like the easiest piece of the puzzle. Below is what my db looks like:

{ "_id" : ObjectId( "507d6fc757299e4a0c000002" ),
  "biz_name" : "Shop Co",
  "services" : [ 
    { "_id" : ObjectId( "508c066a57299ef138000008" ),
      "s_and_p_service_description" : "what a great pie",
      "s_and_p_service_title" : "Pie" }, 
    { "_id" : ObjectId( "508c079357299ef138000009" ),
      "s_and_p_service_title" : "Fruit",
      "s_and_p_service_description" : "what a great fruit" } ],
  "updated_at" : Date( 1351354259379 ),
  "user_id" : ObjectId( "507d6fc757299e4a0c000001" ) 
}

I thought something like this would have done it in:

<% @profile.services.each do |service| %>                           
    <%= @profile.services.s_and_p_service_title %>
<% end %>

but I get the follow error:

undefined method `s_and_p_service_title' for #<Array:0x007fa22a643c18>

What am I doing wrong?

  • 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-13T10:41:17+00:00Added an answer on June 13, 2026 at 10:41 am

    I think you copy/pasted a little bit too much there. Try this:

    <% @profile.services.each do |service| %>                           
        <%= service.s_and_p_service_title %>
    <% end %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just a quick newbie question here. I have a method that calculates a value
Newbie question. I have Django models that look like this: class Video(models.Model): uploaded_by =
Newbie question here: I'm using ANSI C on server to crunch numbers for a
SSRS newbie question here... I have a table where one column is varbinary(max) data.
Here is a newbie scala question. I have a list of people with Person
Newbie question here ... I've created a Master-Detail Application project in Xcode 4.2 using
Pardon the dumb newbie question here; web programming isn't my forte... (blush) I have
Another newbie question here, I have the following Select: SELECT DATEADD(dd, 0, DATEDIFF(dd, 0,
Just a general question here, I have an iPhone app that has 3 textfields
Newbie question here. I'm in the beginning stages of laying out a site in

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.