N+1 query problem
- ORMs make it easy to a query per loop iteration, which we want to avoid
eager_load
- single query (left outer join)
- can reference the other table's columns in
where
preload
- a few queries (one per table)
- typically faster
N+1 query problem
eager_load
wherepreload
| HTTP status code symbols for Rails | |
| Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings. | |
| Status Code Symbol | |
| 1xx Informational | |
| 100 :continue | |
| 101 :switching_protocols | |
| 102 :processing |
Это старая версия урока, которая больше не обновляется. Новая версия расположения тут: https://github.com/codedokode/pasta/blob/master/db/patterns-oop.md
Разберемся, как правильно с применением ООП сохранять и загружать данные из базы. Существуют такие подходы:
sudo su postgres
psqlupdate pg_database set datistemplate=false where datname='template1';
drop database Template1;
create database template1 with owner=postgres encoding='UTF-8' lc_collate='en_US.utf8' lc_ctype='en_US.utf8' template template0;
update pg_database set datistemplate=true where datname='template1';In your command-line run the following commands:
brew doctorbrew update| URL | HTTP Verb | Action |
|---|---|---|
| /photos/ | GET | index |
| /photos/new | GET | new |
| /photos | POST | create |
| /photos/:id | GET | show |
| /photos/:id/edit | GET | edit |
| /photos/:id | PATCH/PUT | update |
| /photos/:id | DELETE | destroy |
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |