diff options
author | Ryan Bigg <radarlistener@gmail.com> | 2012-05-16 17:57:24 +1000 |
---|---|---|
committer | Ryan Bigg <radarlistener@gmail.com> | 2012-05-16 18:05:35 +1000 |
commit | 9c76aa0cc57aacb9f719bfb8aaeac5b7ad1711a5 (patch) | |
tree | 898ba694cdb05fd606cf525e3ea12c949fb35721 /guides | |
parent | 9073cf85dbab49fe845225b62129929938f0c7c9 (diff) | |
download | rails-9c76aa0cc57aacb9f719bfb8aaeac5b7ad1711a5.tar.gz rails-9c76aa0cc57aacb9f719bfb8aaeac5b7ad1711a5.tar.bz2 rails-9c76aa0cc57aacb9f719bfb8aaeac5b7ad1711a5.zip |
[getting started] grammatical changes at beginning of update action section
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/getting_started.textile | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/guides/source/getting_started.textile b/guides/source/getting_started.textile index 5c5e73c1d1..41dd499717 100644 --- a/guides/source/getting_started.textile +++ b/guides/source/getting_started.textile @@ -832,21 +832,23 @@ it look as follows: <%= link_to 'Back', :action => :index %> </erb> -This time we point the form to the +update+ action (not defined yet). +This time we point the form to the +update+ action, which is not defined yet +but will be very soon. + The +:method => :put+ option tells Rails that we want this form to be -submitted via +put+, which is the http method you're expected to use to +submitted via the +PUT+, HTTP method which is the HTTP method you're expected to use to *update* resources according to the REST protocol. TIP: By default forms built with the +form_for_ helper are sent via +POST+. -Moving on, we need to add the +update+ action. The file +Next, we need to add the +update+ action. The file +config/routes.rb+ will need just one more line: <ruby> put "posts/:id" => "posts#update" </ruby> -And the +update+ action in +posts_controller+ itself should not look too complicated by now: +And then create the +update+ action in +app/controllers/posts_controller.rb+: <ruby> def update @@ -860,7 +862,7 @@ def update end </ruby> -The new method +update_attributes+ is used when you want to update a record +The new method, +update_attributes+, is used when you want to update a record that already exists, and it accepts an hash containing the attributes that you want to update. As before, if there was an error updating the post we want to show the form back to the user. |