Skip to content

Instantly share code, notes, and snippets.

@charliegerard
Last active August 29, 2015 13:57
Show Gist options
  • Save charliegerard/9610450 to your computer and use it in GitHub Desktop.
Save charliegerard/9610450 to your computer and use it in GitHub Desktop.

#Day 17

rails console is the same thing as pry.

Your terminal shoul have 4 tabs open with shell, server, pry and psql.

"rm -rf folder name" in pry to remove a folder

rake db:drop to remove a database

rake -T see a list if tasks you can do.

in psql, \c creates a database and \d gives you a list of the databases ou have.

CONVENTION: database names have to be plural but the class name has to be singular.

If we launch "annotate" from within the folder, the table properties are automatically loaded in our class rb file.

in the database, the id is not generated as lon as the object is not saved.

rake db:rollback removes the table, we can then make a change in the parameters and re-do rake db:migrate to re-implement the table in the database.

"raise "some error"" lets you inspect the page. Equivalent of binding.pry

rails g controller Home index number text assets url

(http://www.pragtob.info/rails-beginner-cheatsheet/)

(http://guides.rubyonrails.org/migrations.html)

rake db:create rake db:migrate rake db:seed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment