Permalink
Browse files

Getting Started: remove reference to attr_accessible

  • Loading branch information...
1 parent 8bc945d commit e8b26258d0365d57f51eb81b7162fe576da5f6da @steveklabnik steveklabnik committed Nov 29, 2012
Showing with 0 additions and 11 deletions.
  1. +0 −11 guides/source/getting_started.md
@@ -693,7 +693,6 @@ 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
```
@@ -703,21 +702,13 @@ 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. 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
Rails includes methods to help you validate the data that you send to models.
Open the `app/models/post.rb` file and edit it:
```ruby
class Post < ActiveRecord::Base
- attr_accessible :text, :title
-
validates :title, presence: true,
length: { minimum: 5 }
end
@@ -1229,7 +1220,6 @@ First, take a look at `comment.rb`:
```ruby
class Comment < ActiveRecord::Base
belongs_to :post
- attr_accessible :body, :commenter
end
```
@@ -1292,7 +1282,6 @@ makes each comment belong to a Post:
```ruby
class Comment < ActiveRecord::Base
belongs_to :post
- attr_accessible :body, :commenter
end
```

0 comments on commit e8b2625

Please sign in to comment.