page.insert_html:bottom, :tasks, :partial => 'task', :object =>
Task.new
end %>
<p><%= submit_tag "Create Project" %></p>
<% end %>
#My controller i.e projects
class ProjectsController < ApplicationController
def index
@projects = Project.find(:all)
end
def new
@project = Project.new
@project.tasks.build
end
def create
@project = Project.new(params[:project])
if @project.save
flash[:notice] = "Successfully created project and tasks."
redirect_to projects_path
else
render :action => 'new'
end
end