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.
On Thu, Jul 17, 2008 at 10:10 PM, Adam Walters <
rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:
>
> 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
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---