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 3392622
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T03:56:48+00:00 2026-05-18T03:56:48+00:00

I’m trying to created a set of nested (many-to-many) forms in rails 3. Everything

  • 0

I’m trying to created a set of nested (many-to-many) forms in rails 3. Everything works fine thanks to fields_for, but I need to put a title above each nested form. That title has the value of the profession_type.name field (which has a prepopulated value) in each respective nested form.

I’m having a heckuva time extracting that profession_type.name value from fields_for form objects. What I need to know is either:

a.) Is it possible to extract prepopulated values from fields_for objects, and if so how?

or

b.) How can I make a many-to-many nested form loop over only the relevant “fields_for” entry for each |specform| value, instead of all of them?

Any suggestions using either method (or alternative approaches) very much appreciated.

<% @professional.professional_specialties.each do |specform| %>
    <%= specform.profession_type.name %>

    <% f.fields_for :professional_specialties do |specialtyform| %>
        <%= specialtyform.label :profession_type %>
        <%= specialtyform.text_field :profession_type %>
        <%= specialtyform.label :qualifications %>
        <%= specialtyform.text_field :qualifications %>
        <%= specialtyform.label :license_number %>
        <%= specialtyform.text_field :license_number %>
        <%= specialtyform.label :enabled %>
        <%= specialtyform.check_box :enabled %>
    <% end %>
<% end %>
  • 1 1 Answer
  • 1 View
  • 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-18T03:56:49+00:00Added an answer on May 18, 2026 at 3:56 am

    The FormBuilder has attribute accessors like :object_name and :object.

    For your particular issue try using:
    <%= specform.object.name %>

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I want to count how many characters a certain string has in PHP, but
I need to clean up various Word 'smart' characters in user input, including but
Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to render a haml file in a javascript response like so:
I have a French site that I want to parse, but am running into
In my XML file chapters tag has more chapter tag.i need to display chapters

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.