Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6769289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:10:32+00:00 2026-05-26T15:10:32+00:00

Here is my fields_for block in my edit view of the orders controller <%=

  • 0

Here is my fields_for block in my edit view of the orders controller

  <%= form_for @order do |f| %>

    <%= f.fields_for :order_fields do |builder| %>
      <%= builder.text_field :value %>
    <% end %>

  <% end %>

The problem I am having is that I would like to use an each loop to display information from the loop, but then i get the form displayed more than once. this is because i used the accepts_nested_attributes_for :order_fields statement.

Inside my order_fields table there is a column named name that I would like to display the information from in the form. How can I do this? The information from the value column in my database is displayed in my form already.

If i do

<%= f.fields_for :order_fields do |builder| %>
  <%= builder.text_field :name %>
  <%= builder.text_field :value %>
<% end %>

it displays information from both columns next to each other, but I would like the :name information not to be in a text box or anything. I would like it to be displayed as if i were to do something like:

<% @order.order_fields.each do |field| %>
  <%= field.name %>
<% end %>

I hope this make some sense 🙂
Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T15:10:33+00:00Added an answer on May 26, 2026 at 3:10 pm

    You can access the object off of |builder| by calling .object on it

    <%= f.fields_for :order_fields do |builder| %>
      <%= builder.object.name %>
      <%= builder.text_field :value %>
    <% end %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So here's the scenario: User: has_one :company accepts_nested_attributes_for :company Controller: @user = User.new @user.build_company
I am trying to make a view that allows a user to edit a
I have isolated the problem in the second block of code below (if you
I have a problem with nested forms: rails 3.1 doesn`t render fields_for blocks when
ANY insight here is greatly appreciated. From inside of a form_for in rails, I'm
Have a simple form (only extract fields here) but for some reason the JQserilization
Here is a related manager I wrote: class PortfolioItemManager(models.Manager): use_for_related_fields = True def extended(self):
What do people here use C++ Abstract Base Class constructors for in the field?
Here is a simplification of my database: Table: Property Fields: ID, Address Table: Quote
public class A { //some fields (may not only primitive types) and methods here}

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.