I am trying to follow a ruby on rails scaffold example.

I am using `ruby version: 2.1.5` with `rails version : 4.1.8`

I have used this command:

```
rails generate scaffold User name:string email:string

```

This worked fine - I can run the example which shows crud functionality to my generated scaffold. The examples I have been following advise to look at the model file generated. The ones in the examples seemed to have a value called attr\_accessible - but for me this was not generated - I do not know why - it seems to be quite useful so you can easily see what is inside your model? My model looks like this:

```
class User < ActiveRecord::Base

end

```

I altered it to look like this :

```
class User < ActiveRecord::Base
    attr_accessible :name, :email
    validates :name, :presence=>true
end

```

and when I now visit localhost/users I get the error:

![Error](https://i.stack.imgur.com/DyWwL.png)

Can somebody please tell me how a generated model can be created with this attr\_accessible line, and how I can add an example of validation to the model.