Sorry, there was a typo: <% from.fields_for :my_collection do |
fields_for_object| %> should have been <%
form.fields_for :my_collection do |fields_for_object| %>. Also, after
thinking about it, what I am really looking for is access to the
collection object being processed, not just one of it's attributes.

Any help would be much appreciated.

Thank you.

On Jan 9, 5:40 pm, pepe <[email protected]> wrote:
> I need to display information from the collection in a fields_for
> without using the fields_for block's object. For example, in the
> following code:
>
> <% form_for :my_object, @my_object, :url => { :action => "my_action" }
> do |form| %>
>     Last name: <%= form.text_field :last %>
>     <% from.fields_for :my_collection do |fields_for_object| %>
>
>         <%= fields_for_object.text_field :my_attribute %> # <<<<< This
> is the line I'm having trouble with.
>
>     <% end -%>
>     <%= submit_tag 'Save' %>
> <% end %>
>
> I would like to replace:
>         <%= fields_for_object.text_field :my_attribute %>
>
> With simply:
>         <%= @an_object.my_attribute %>
>
> Basically I just want to display an attribute that belongs to the
> collection object being processed as text, with no 'input' box or
> anything else around it. I have looked and looked but couldn't find an
> example. Is this possible?
>
> Thank you.
-- 
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