rails - form to disply non-input type fields in nested form

Posted by nktokyo on Stack Overflow See other posts from Stack Overflow or by nktokyo
Published on 2011-02-05T15:22:01Z Indexed on 2011/02/05 15:25 UTC
Read the original article Hit count: 177

Filed under:

Hi,

I guess this is a newbie question, but what is the syntax in a form to show contents of fields not as a text box/area, but rather like label would appear.

<% form_for @user do |f| %>
    <% f.fields_for :user_ingreds do |builder| %>
        <p>
            <%= builder.??? %>
        </p>
    <% end %>
<% end%>

user has many user_ingreds and accepts_nested_attributes for user_ingreds. Basically I want to make a list of user_ingreds where the user can't edit the data but can remove the record from the list via a button - however the fields_for builder doesn't recognize a direct call to to the fields in user_ingreds model (ie, builder.user_id throws and error.

© Stack Overflow or respective owner

Related posts about ruby-on-rails