diff options
author | Jason Noble <github+jasonn@jasonnoble.org> | 2012-11-24 21:37:53 -0700 |
---|---|---|
committer | Jason Noble <github+jasonn@jasonnoble.org> | 2012-11-24 21:37:53 -0700 |
commit | 85db49fd8d7a14cc0126f1a2516effbea33d715f (patch) | |
tree | 781cc8e73750c234d225bfda6df7eac34accba9d /guides | |
parent | c332393f751fdbd2bf1c821e2ac1fa5f06fea7b6 (diff) | |
download | rails-85db49fd8d7a14cc0126f1a2516effbea33d715f.tar.gz rails-85db49fd8d7a14cc0126f1a2516effbea33d715f.tar.bz2 rails-85db49fd8d7a14cc0126f1a2516effbea33d715f.zip |
Modified "Allowing the update of fields" section
* Rails generate model Post ______ creates the
attr_accessible line for you for any fields
you specify. Changed the section to describe
what this line in the model does.
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/getting_started.md | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md index 76a2a3c1be..546230dbdd 100644 --- a/guides/source/getting_started.md +++ b/guides/source/getting_started.md @@ -693,6 +693,7 @@ The model file, `app/models/post.rb` is about as simple as it can get: ```ruby class Post < ActiveRecord::Base + attr_accessible :text, :title end ``` @@ -702,18 +703,11 @@ your Rails models for free, including basic database CRUD (Create, Read, Update, Destroy) operations, data validation, as well as sophisticated search support and the ability to relate multiple models to one another. -Rails includes methods to help you secure some of your model fields. -Open the `app/models/post.rb` file and edit it: - -```ruby -class Post < ActiveRecord::Base - attr_accessible :text, :title -end -``` - -This change will ensure that all changes made through HTML forms can edit the content of the text and title fields. -It will not be possible to define any other field value through forms. You can still define them by calling the `field=` method of course. -Accessible attributes and the mass assignment problem is covered in details in the [Security guide](security.html#mass-assignment) +Rails includes methods to help you secure some of your model fields. The Rails +model generator added the attr_accessible line to your model file. This change +will ensure that all changes made through HTML forms can edit the content of +the text and title fields. Accessible attributes and the mass assignment problem is covered in +details in the [Security guide](security.html#mass-assignment) ### Adding Some Validation |