Saturday, March 23, 2013

[Rails] Re: Rails 4.0 Example app - fields_for

On Friday, March 22, 2013 2:20:09 AM UTC+2, jle...@socit.co.uk wrote:
So I have a rails 3.2.11 Example app that exhibits some simple core use cases and I am starting again under rails 4.0.0.beta1

    <div>
        <h2><%= f.label r %></h2>
        <%= f.fields_for :interactions, s.initialized_interactions() do |builder| %>
            <% role = builder.object.role %>
            <%= builder.hidden_field :role_id %>

            <div class="field">
                <%= builder.check_box :enable %>
                <%= builder.label :enable, role.name %>
            </div>
        <% end %>
    </div>

 So the above renders OK for 3.2 but under rails 4.0 'builder.object' is an array of role objects and of course it fails.

Any ideas ?

Have you tried to display builder.object on screen, or in rails console? If you do it both in 3.2 and 4, you should be able to see if there is a difference. 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/LaKKMvtRU-sJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate