I’m trying to change something i did in 2.8 to 3.
What it does is build a blank object in the model from the show action in the controller like so.
@project.tasks.build
and then in the show view i can do something like this
<% form_for @project do |c| %>
<% c.fields_for :tasks, @project.tasks.last do |p| %>
<%= p.text_field :name, :label => 'add task' %>
<% end %>
<%= submit_tag '+' %>
<% end %>
in this instance it would show just the blank record for entry.
in another instance i could remove .last and have all the related tasks editable from the show action of the project.
how do I do this in Rails 3? because it’s giving me this error.
undefined method `name' for #<Array:0xb2b33d8>
my bad, i forgot
accepts_nested_attributes_forin my model