Forum: Ruby on Rails non-RESTful action or nested routes?

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.
davetron5000 (Guest)
on 2008-11-16 23:27
(Received via mailing list)
I'm creating a simple task management system to learn Rails.  I have a
"task" which is part of a "project", as so:

/projects/5/tasks

for project with id 5's tasks

My task has a concept of being started, completed and updated.

"Updating" maps to the existing RESTful routes provided by Rails.

Started and completing, however, do not (at least not in an obvious
way).  I don't want to overload "update", nor do I want to modify the
UI to fit "start task" into a form of update.

I can see two options:

1 - create named routes on task for "start" and "complete" (post to
these does the action in question)

2 - create subresources of project for "completed_tasks" and
"started_tasks" (where a post to /projects/5/completed_tasks/78 would
"complete" task #78 of project #5)

Which would be the "least surprising" way to do this, from a Rails
perspective?

Dave
This topic is locked and can not be replied to.