simple form - Rails simple_form Nested Model Fields Won't Render -


i'm using rails 3.2 , simple_form build application. i'm trying have each nested model display it's fields in different tab using twitter bootstrap. reading stack overflow questions people seemed recommend cocoon gem i've installed too. i'm trying follow example on cocoon site (https://github.com/nathanvda/cocoon) reason it's not working. (could problem in translation of slim standard rails).

here code, i'm doing best strip out pieces aren't relevant.

here models:

class superrequest < activerecord::base attr_accessible (all of fields) has_many :prisms accepts_nested_attributes_for :prisms  class prism < activerecord::base attr_accessible :access, :business_client, :sla belongs_to :super_request 

my form follows:

<%= simple_form_for @super_request, :html => {:class => 'form-horizontal'} |f| %> <div class="tabbable"> <!-- required left/right tabs -->  <ul class="nav nav-tabs">   <li class="active"><a href="#tab1" data-toggle="tab">basic information</a></li>   <li><a href="#tab2" data-toggle="tab">prism</a></li>   <li><a href="#tab3" data-toggle="tab">computer</a></li>   <li><a href="#tab4" data-toggle="tab">software</a></li>   <li><a href="#tab5" data-toggle="tab">im</a></li>  </ul> <div class="tab-content"> <div class="tab-pane active" id="tab1">   <%= f.input :ntid, label: 'ntid' %>   (a lot more fields) </div>  <div class="tab-pane" id="tab2">   <p> content prism </p>     <%= f.simple_fields_for :prisms |prism| %>       <%= render 'prism_fields', :f => prism %>     <% end %> </div> 

i've created partial prism fields. here have in partial.

<%= .nested-fields %> <%= f.inputs %>   <%= f.input :access %>   <%= f.input :business_client %>   <%= f.input :sla %> <% end %> 

the page renders , hard coded text "content prism" shows up. but, fields prism not.

all appreciated.

are build prism objects?
example:
1) <% @super_request.prisms.build %>
or several objects:
2)<% 3.times {@super_request.prisms.build} if @super_request.prisms.empty? %>

update: example, try paste after :

<p> content prism </p> 

this line of code:

<% @super_request.prisms.build %> 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -