I haven't had any responses in the past few days, so the problem must
be unsolvable in Rails. ;) LOL

But let me rephrase the question more succinctly.

Assume, Shelf has a description and a set of items. Item has a
description, sku and color.
Given, I use build in my controller's new method to create a set of
models like this:
@shelf = Shelf.new
3.times { @shelf.items.build(:sku => GenerateNewSku, :color =>
'blue') }

Explain how to display the sku and color in the form for each item?
<% form_for @shelf do |f| %>
        <%= f.label :description %>
        <%= f.text_field :description %>

        <% f.fields_for @shelf.items do |item_fields| %>
                <%# ****Want :sku here**** #%>
                <%# ****Want :color here**** #%>
                <%= item_fields.text_field :description %>
        <% end %>

        <%= f.submit %></p>
<% end %>

Why I want this: My app has Surveys, and each has many Questions. Each
Question has many Answers (one per user). The Answers also belong to a
Response, which belong to a User. Response can be thought of as the
user's answers to a Survey. If that's not clear, imagine a data
diagram in the shape of a diamond, with Survey at the top branching
down into Questions and Responses at the next level, and Answers at
the bottom. Each level is has_many with the one below it.

In the Response's form, I want to display Question.ask for each
question in the Survey as a label for each Answer in the Response.
Maybe there is a better way to go about doing this, but I've tried
numerous approaches, refactoring the databases, and am just about to
switch over to .NET (jk).

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to