Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def new_task_attributes=(task_attributes)
- task_attributes.each do |attributes|
- tasks.build(attributes)
- end
- end
- def test_adding_task_to_project
- p = Project.new
- params = {"new_tasks_attributes" => [{ "name" => "paint fence"}]}
- p.new_tasks_attributes=(params)
- p.save
- assert p.tasks.length == 1
- end
- def test_adding_task_to_project
- p = Project.new
- new_tasks_attributes = [{ "name" => "paint fence"}]
- p.new_tasks_attributes = (new_tasks_attributes)
- p.save
- assert p.tasks.length == 1
- end
Add Comment
Please, Sign In to add comment