Forum: Ruby on Rails Simple form with option to go to advanced form

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
803ad415efcdcbf09b1addeb319650d7?d=identicon&s=25 Adam Akhtar (thegeezer3)
on 2009-02-07 04:13
I have a todo list involving projects and tasks and im using nested
resources. In Projects Show - i list all tasks associated with the
project. I also have a simple "add task" which allows the user to add a
task but only specify the title. Other attributes are set to default
(e.g. due date = None, priority = NA etc).
This form is sent to project_tasks_path i.e. create in Task Controller.

I want an "Advanced Add Task" button on this form which when clicked
will reload the same project show view but with a full form comprising
of title, due date, lable etc.

I know i can create a new submit button in the current form

  <%= submit_tag "Advanced Add Options", :class => "submit_advanced",
:name => "advanced_add" %>

and then in the receving action use

if params[:advanced_add]
render :show
end

and in show have

if params[:advanced_add]
show the advanced form
else
show the simple form
end

but because the form is going to create in the task controller it means
the task controller create action is managing the projects show actions
logic which i dont think is good.

I thought about using link_to but I can only pass  an :id via params to
the controller.
How do i go about this?
This topic is locked and can not be replied to.