$ su - postgres $ psql --version
$ sudo apt-get install postgresql-server-dev-9.3
$ rails new <project name> --database=postgresql
(Example)
$ rails new sample --database=postgresql
$ vi Gemfile gem 'therubyracer', platforms: :ruby ... gem 'execjs'
(You can see sample from here)
$ bundle install
$ su - postgres $ cd /etc/postgres/9.3/main $ vi pg_hba.conf
local all postgres trust local all all trust
$ /etc/init.d/postgres restart
$ su - postgres $ psql -d postgres postgres=# create role <user_name> login createdb; postgres=# \q
(Example)
postgres=# create role sample login createdb;
$ vi config/database.yml
default: ... username: <user_name>
(Example)
username: sample
(You can see sample from here)
(Example)
$ rails generate controller welcome
(Example)
$ vi app/views/welcome/index.html.erb
<h2>Hello World</h2> <p> <a href="/users">user list</a> <br> <%= Time.now %> </p>
(You can see sample from here)
(Example)
$ rails generate scaffold user
$ vi config/routes.rb
root 'welcome#index'
Create and migrate initial database.
$ rake db:create $ rake db:migrate
$ rails dbconsole
$ rails s
You will see the following window.
And also, you can edit user list.
S.Yatsuzuka