Hello, I have the following:

My Controller:

      def new
    .
    .
        @teammembers.each do |teammember|
            request = @request_thread.requests.build(:recipient_id =>
teammember.user_id, :full_name => 'Billy Bob T')
        end

My View:
.
.
        <%= f.fields_for :requests do |builder| %>

                <div class="field">
                        <%= builder.label :full_name %>
                        <%= builder.check_box :recipient_id, :checked => false 
%>
                </div>
        <% end %>
.
.
The nested form for requests only holds the user_id, not the
user.name... Problem is in the nested form, I need to show the
user.name next to the check_box. So I tried adding a virtual attribute
in the model (attr_accessor :full_name), so I could use full_name but
I can't see to access that in the nested form (inside builder).

Also, the checkbox doesn't have the recipient_id as the value being
set? I want to use the checkbox to tell Rails whether or not to create
the record or not on submit using something like this in the model
":reject_if => lambda { |a| a[:recipient_id].blank? }"

Anyone with fields_for experience?


Any tips or suggestions from the pros?

Thanks

-- 
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