RESTful Question -- Extra Member Routes

Hello,

Still getting my feet wet with Rails, and especially RESTful Rails and am looking for some help tackling an issue

In routes.rb i have:

  map.resources :houses do |house|     house.resources :chores, :member => {:complete => :any}   end

This way when a user goes to mark a chore as complete, i call the ChoresController:complete action to pull up a form to select who completed the given chore.

I'm curious as to how i RESTfully update this chore. I can't use the update action as that is used by the edit form, plus i need to add some additional details, such as the completed_at time.

Is there a way to detect in the complete action whether it's a PUT or a GET request? Any recommendations on how to RESTfully handle this would be appreciated.

Thanks! Adam

Actually you should try to use the update. completing a task simply changes the task details. Your view can contain a “mark completed” checkbox that sets the completion date (and you could set the date in the model automatically or you could ask for it on the form) but it would still go to the update action. Heck, if you can use attr_accesors and database fields on your task model, you don’t even need to change your code - update_attributes will just assign things where they need to be and you can use before_update in your model to do any other things you need to do.

In my experience with REST there are so few reasons to use additional methods.