Chapter 3 Flashcards
where are rails actions?
in the controller
switch to branch “static-pages”
git checkout -b static-pages
how can we generate a controller?
rails generate command to generate scaffolding
steps to make a controller to handle static pages
create StaticPages controller using generate. plan to make actions for home page, help page and about page.
$ rails generate controller StaticPages home help
$ rails generate conroller StaticPages home help
generates StaticPages controller with actions for home and help
scaffolding
generate major pieces of an application to create models, views, and controllers for a new resource
rails g
rails generate shortcut
rails c
rails console shortcut
bundle install
bundle shortcut
rake test
rake shortcut
git push -u origin static-pages
pushes topic branch up to github
destroy controller StaticPages:
rails destroy controller StaticPages home help
generate a model using scafffolding
rails generate model User name:string email:string
undo model generated User
rails destroy model User
bundle exec rake db:migrate
change the state of the database
undo db:migrate
bundle exec rake db:rollback (undo a single migration)
route file
responsible for implementing the router(defining the correspondence between URLs and web pages).