So I’ve got a form and it’s has some accepts_nested_attributes_for items in it.
It’s a project, task thing and what I’m wondering is if I can put the person creating the project as the leader (default first value for project_member) in the form itself or if this is something that should be handled on the create method of the controller.
Here’s the new action on the project controller
def new
@project = Project.new
3.times {@project.tasks.build}
3.times {@project.project_members.build}
3.times {@project.milestones.build}
respond_to do |format|
format.html {render :layout => "base"}
format.js {render :layout => false}
end
end
So basically, when building the project_members field, I’m wanting to be able to grab the person creating the form (based on session[:user]) and insert them as the first field in the list.
Any help or pointers to some kind of tutorial is REALLY appreciated.