search for: nested_form_for

Displaying 4 results from an estimated 4 matches for "nested_form_for".

2011 Feb 26
1
How to manage the form of a model that has two foreign keys
...se belongs_to :zz_user_id, :class_name => "User" belongs_to :user_godfather_id, :class_name => "User" end Now my question is about how to manage the edit form of this nested attribute relationships. Here is how my form looks like at the moment (using the nested_form_for gem): <%= nested_form_for @user do |f| %> <%= f.fields_for :godfathers do |godfather_form| %> # Here I have an ID text field but what I want instead is # to provide a username for this godfather. <%= go...
2011 Jul 16
0
nested_form gem don't work for accepts_nested_attributes_for :limit
...class Post < ActiveRecord::Base has_many :image, :dependent => :destroy accepts_nested_attributes_for :image, :allow_destroy => true, :limit => 4 end class Image < ActiveRecord::Base belongs_to :Post ... paperclip settings ... end And the form view for the post is: <%= nested_form_for @post, :html => { :multipart => true } do |f| %> <%= f.fields_for :images do |i| %> <% if i.object.new_record? %> <%= i.file_field :photo %> <% else %> <%= image_tag(i.object.photo.url(:thumb)) %> <% end %> <%= i.link_to_...
2013 Feb 10
0
Nested attributes doesnt get updated
...ActiveRecord::Base set_primary_key :w_a_detail_id set_sequence_name "w_a_details_seq" set_table_name "w_a_details" attr_accessible :description belongs_to :a_w_request def to_param w_a_detail_id.to_i.to_s end end *Forms:* *a_w_requests/_form.html.erb: *<%= nested_form_for(@a_w_request) do |f| %> <label><b>*Requester Contact</b></label> <%= f.text_field :requester_contact %> </div> <div class="field"> <label><b>*Needed By</b></label> <%= f.date_select :needed_by, :...
2011 Oct 26
6
Add an index to a form
Hello, I''m having some trouble with forms, my app allows to enter data by using a multi-step form that has 7 steps. There are 3 steps that may let the user to add 1 form, for example there''s a step called "children" and that children has the following fields: * name * age * gender but one father may have more than 1 child and I''m adding another form with