From 85db49fd8d7a14cc0126f1a2516effbea33d715f Mon Sep 17 00:00:00 2001 From: Jason Noble Date: Sat, 24 Nov 2012 21:37:53 -0700 Subject: 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. --- guides/source/getting_started.md | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'guides/source/getting_started.md') 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 -- cgit v1.2.3