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

  • Home
  • SEARCH
  • 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 6660503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:09:48+00:00 2026-05-26T02:09:48+00:00

I am using the rails 3 gem nested_forms and would like to change how

  • 0

I am using the rails 3 gem nested_forms and would like to change how the default blueprint for insertion is generated. I can not figure out how/where this code would comes from, and how/where I would add code to modify it.

I am currently using a partial for my form:

/app/views/units/_unit.html.haml

%tr
  %td=f.text_field :units 
  %td=f.text_field :dispatched
  %td=f.text_field :onscene
  %td=f.text_area  :actions

The code snippet that calls the partial:

/app/vies/reports/_form.html.haml

...    
%table.units
  %th Unit
  %th Dispatched%th On Scene
  %th Actions
=f.fields_for :units

%p= f.link_to_add "Add a unit", :units
...

I have all of the core functionality working, except for the template. That is auto created at run time by the gem. This template results in very simple HTML markup being used for the template.

Which is similar to the following:

<div id="units_fields_blueprint" style="display:none">
  <p class="fields">
    <input id="report_units_attributes_new_units_unit" name="report[units_attributes][new_units][unit]" size="30" type="text">
    <input id="report_units_attributes_new_units_dispatched_1i" name="report[units_attributes][new_units][dispatched(1i)]" type="hidden" value="2011">
    ...
  </p>
</div>

I would like the blueprint to have the tabular format that is in the partial, I just don’t know how to get there.

Any help would be appreciated.

  • 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-26T02:09:49+00:00Added an answer on May 26, 2026 at 2:09 am

    A partial which contains only a table row, such as listed above will not be valid markup when placed within the blueprint div.

    The following code is not valid markup.

    <div>
      <tr>
        <td>Content</td>
      </tr>
    </div>
    

    Certain browsers (chrome for example) will attempt to correct this bad markup, which is done by stripping out the tr and td markup.

    To get this type of code to work with nested_form would be complex requiring that the blueprint be created in a javascript string, and would require a modification to the builder to stop automatically surrounding inserted code in a block of code.

    These changes are addressed in issue #73 for nested_form which refers to a branch created by the github user elmatou.

    Another option to get a similar look and feel is to use divs and spans and create a grid structure using CSS. This is a CSS intensive process, but allows nested_form to be used without requiring alteration.

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

Sidebar

Related Questions

Using Rails 3.2 and ruby 1.9.3p0 I am trying out the gem delayed_job. I
Rather than using the latest Rails gem for my application, I like to have
I'm deploying to Ubuntu slice on slicehost, using Rails 2.1.0 (from gem ) If
I'm using daemons gem with Rails in addition to daemon_generator plugin. I'm getting this
I'm using gem bundler (v.0.9.6) and Rails 2.3.5, rubygems 1.3.6 and ruby 1.8.7 (On
I'm using the will_paginate gem for my Rails project and it's working beautifully. Unfortunately,
We're thinking about using the rufus-scheduler gem on a Ruby on Rails project to
I'm making my first Rails project and I'm using the simple_form gem (version 1.0)
I'm using a rails gem that generates breadcrumbs in the following format: <div class=breadcrumbs>
Im using the Rails Roo Gem. I want to be able to get a

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.