<— Tutorial | TutorialStepTwo —>
Create a database named rails_production
using linux console:
su (Enter Password) su postgres createdb rails_production
Create a user for the database
Using linux console
createuser -P
(Give a name)
(Give a password)
(Set Permissions)
To create the table using migrations see instructions at TutorialStepOneMigrations. Note also the instructions at the bottom for connecting Ruby with Postgres.
To create the table by hand do the following:
Sql code to create the table
CREATE TABLE people (
id SERIAL PRIMARY KEY,
name TEXT NOT NULL default ‘’,
street1 TEXT NOT NULL default ’’,
street2 TEXT NOT NULL default ‘’,
city TEXT NOT NULL default ’’,
state TEXT NOT NULL default ‘’,
zip TEXT NOT NULL default ’’
);CREATE INDEX idx_people_name ON people(name);
INSERT INTO people
VALUES (1, ‘Superman’, ‘123 Somewhere’, ‘’, ’Smallville’, ‘KS’, ’123456’);
Make sure you have the “Ruby ”http://wiki.rubyonrails.com/rails/pages/PostgreSQL" class="existingWikiWord">PostgreSQL adapter":http://www.postgresql.jp/interfaces/ruby/ installed
Get the C bindings:gem install postgresor use the pure-Ruby bindings on Windows:
gem install postgres-pror grab the C bindings for Windows here
change the adapter lines in config/database.yml to:
adapter: postgresql
Make sure you have configured local access by md5 autentication method in pg_hba.conf (not recommended) from
# "local" is for Unix domain socket connections only local all all ident sameuser
to
- “local” is for Unix domain socket connections only
local all all md5
or (recomended) configure config/database.yml to
host: 127.0.0.1
and change the listen_address option in postgresl.conf to like
listen_address = ‘127.0.0.1’
<— Tutorial | TutorialStepTwo —>
category:Tutorial
Bath and Shower
Fragrance
Gift Sets
Hair Care
Makeup
Men’s Grooming
Shaving and Hair Removal
Skin Care
Tools and Accessories
Baby Apparel
Baby Bathing & Skin Care
Baby Bedding
Baby Car Seats
Baby Diapering
Baby Feeding
For Moms
Baby Furniture
Baby Gear
Baby Gifts
Baby Health & Baby Care
Nursery Décor
Potty Training
Baby Safety
Baby Strollers
<— Tutorial | TutorialStepTwo —>
Create a database named rails_production
using linux console:
su (Enter Password) su postgres createdb rails_production
Create a user for the database
Using linux console
createuser -P
(Give a name)
(Give a password)
(Set Permissions)
To create the table using migrations see instructions at TutorialStepOneMigrations. Note also the instructions at the bottom for connecting Ruby with Postgres.
To create the table by hand do the following:
Sql code to create the table
CREATE TABLE people (
id SERIAL PRIMARY KEY,
name TEXT NOT NULL default ‘’,
street1 TEXT NOT NULL default ’’,
street2 TEXT NOT NULL default ‘’,
city TEXT NOT NULL default ’’,
state TEXT NOT NULL default ‘’,
zip TEXT NOT NULL default ’’
);CREATE INDEX idx_people_name ON people(name);
INSERT INTO people
VALUES (1, ‘Superman’, ‘123 Somewhere’, ‘’, ’Smallville’, ‘KS’, ’123456’);
Make sure you have the “Ruby ”http://wiki.rubyonrails.com/rails/pages/PostgreSQL" class="existingWikiWord">PostgreSQL adapter":http://www.postgresql.jp/interfaces/ruby/ installed
Get the C bindings:gem install postgresor use the pure-Ruby bindings on Windows:
gem install postgres-pror grab the C bindings for Windows here
change the adapter lines in config/database.yml to:
adapter: postgresql
Make sure you have configured local access by md5 autentication method in pg_hba.conf (not recommended) from
# "local" is for Unix domain socket connections only local all all ident sameuser
to
- “local” is for Unix domain socket connections only
local all all md5
or (recomended) configure config/database.yml to
host: 127.0.0.1
and change the listen_address option in postgresl.conf to like
listen_address = ‘127.0.0.1’
<— Tutorial | TutorialStepTwo —>
category:Tutorial
Bath and Shower
Fragrance
Gift Sets
Hair Care
Makeup
Men’s Grooming
Shaving and Hair Removal
Skin Care
Tools and Accessories
Baby Apparel
Baby Bathing & Skin Care
Baby Bedding
Baby Car Seats
Baby Diapering
Baby Feeding
For Moms
Baby Furniture
Baby Gear
Baby Gifts
Baby Health & Baby Care
Nursery Décor
Potty Training
Baby Safety
Baby Strollers