Why does the generated rails model doesn't have attributes? How does
the rails know what attributes a model has?
In railstutorials.org says that the ActiveRecord scans the columns of
the associated table of the model and thru that it can know the
attributes a model has. Is there more info about this?
Why does the generated rails model doesn't have attributes? How does
the rails know what attributes a model has?
$ rails generate model User name:string email:string
See those things after User???
$ bundle exec rake db:migrate
That creates the db from the "migration" created by 'rails generate
model'.
In railstutorials.org says that the ActiveRecord scans the columns of
the associated table of the model and thru that it can know the
attributes a model has. Is there more info about this?
rails calls attr_accessor() in your model for all the columns in the db.