RailsCasts Pro episodes are now free!

Learn more or hide this

dedek's Profile

GitHub User: dedek

Comments by

Avatar

Hi everyone, I had a problem with my Nested Model From, I am not sure what did I do wrong,

My View projects/_form.html.erb
  <%= simple_form_for @project do |p| %>
          <%= p.input :name %>
          <%= p.input :description %>
    <%= p.simple_fields_for :tasks do |task| %>
      <%= task.input :description %>
    <% end %>
           <%= p.button :submit %>
  <% end %>
My Model - project.rb
  class Project < ActiveRecord::Base
   attr_accessible :description, :name, :tasks_attributes

   has_many :tasks
   accepts_nested_attributes_for :tasks, :reject_if => :all_blank, :allow_destroy => true
  end
My Model - description.rb
class Task < ActiveRecord::Base
  belongs_to :project
  attr_accessible :description, :done
end

When I try to render the from, the nested form field does not appear. Is there any problem with my codes ?