Browse files

Documentation for adding exta methods to update

  • Loading branch information...
blaind committed Feb 15, 2014
1 parent e4fb9fc commit d07d6cdbd2d1a4d8aaf602ef3bb0dc8c622c5b44
Showing with 12 additions and 0 deletions.
  1. +12 −0
@@ -311,6 +311,18 @@ end
Yes, it's that simple! The nice part is since you already set the instance variable
`@project`, it will not build a project again.
+Same goes for updating the project:
+class ProjectsController < InheritedResources::Base
+ def update
+ @project = Project.find(params[:id])
+ @project.something_special!
+ update!
+ end
Before we finish this topic, we should talk about one more thing: "success/failure
blocks". Let's suppose that when we update our project, in case of failure, we
want to redirect to the project url instead of re-rendering the edit template.

0 comments on commit d07d6cd

Please sign in to comment.