>Rails 3 Installation
sudo gem install rails -v3.0.4postgres as db installationbr/$ sudo apt-get install postgresql
Rails 3 App with postgres as database
$ rails new pg -d postgresbundle installation
It will install dependency gems & postgres adapter for db connection
bundle install
Here by default ‘postgres’ database user gets created while installation but i recommend to create new db user with name same as of system user owning project directory permissions.
User owning file permission can be found using
ls -l pgdrwxr-xr-x 7 sandip sandip 4096 2011-02-23 15:38 appdrwxr-xr-x 5 sandip sandip 4096 2011-02-23 18:14 config-rw-r–r– 1 sandip sandip 152 2011-02-23 15:38 config.ru…Default ‘postgres’ database user gets created while installation## Snap of database.ymldevelopment: adapter: postgresql encoding: unicode database: pg_development username: sandip pool: 5
Create new database user
pg $ sudo su postgrespg $ createuser sandipShall the new role be a superuser? (y/n) ypg $ exitexit
Create a first development database:
pg $ psql template1Welcome to psql 8.4.6, the PostgreSQL interactive terminal….template1=# \l List of databases Name | Owner | Encoding ———–+———-+———- postgres | postgres | UTF8 template0 | postgres | UTF8 template1 | postgres | UTF8(3 rows)template1=# CREATE DATABASE pg_development;CREATE DATABASEtemplate1=# \l List of databases Name | Owner | Encoding ——————-+———-+———- postgres | postgres | UTF8 pg_development | sandip | UTF8 template0 | postgres | UTF8 template1 | postgres | UTF8(4 rows)template1=# \q
Start rails server
pg $ rails sGetting hands on postgres terminal
1. Login onto terminal
psql -U DB_USERNAME -d DB_NAME -W DB_PASSWORD2. List databases
\l3. Display tables
\dt4. Exit from terminal
\q
modern material, the “Plouis vuitton hlouis vuitton handbags replicabags replicaora” is perfect with a demure dress. Since your clutch is a show-off,