non-RESTful action or nested routes?

davetron5000
Sun, 16 Nov 2008 21:21:39 -0000

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


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---