ruby on rails getting started my notes
To create first application
# rails
# rails new
create
create app/controllers
create app/helpers
create app/models
create app/views/layouts
create config/environments
create config/initializers
create config/locales
create db
create doc
create lib
create lib/tasks
create log
create public/images
create public/javascripts
create public/stylesheets
create script/performance
create test/fixtures
create test/functional
create test/integration
create test/performance
create test/unit
create vendor
create vendor/plugins
create tmp/sessions
create tmp/sockets
create tmp/cache
create tmp/pids
create Rakefile
create README
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
create config/database.yml
create config/routes.rb
create config/locales/en.yml
create db/seeds.rb
create config/initializers/backtrace_silencers.rb
create config/initializers/inflections.rb
create config/initializers/mime_types.rb
create config/initializers/new_rails_defaults.rb
create config/initializers/session_store.rb
create config/environment.rb
create config/boot.rb
create config/environments/production.rb
create config/environments/development.rb
create config/environments/test.rb
create script/about
create script/console
create script/dbconsole
create script/destroy
create script/generate
create script/runner
create script/server
create script/plugin
create script/performance/benchmarker
create script/performance/profiler
create test/test_helper.rb
create test/performance/browsing_test.rb
create public/404.html
create public/422.html
create public/500.html
create public/index.html
create public/favicon.ico
create public/robots.txt
create public/images/rails.png
create public/javascripts/prototype.js
create public/javascripts/effects.js
create public/javascripts/dragdrop.js
create public/javascripts/controls.js
create public/javascripts/application.js
create doc/README_FOR_APP
create log/server.log
create log/production.log
create log/development.log
create log/test.log
By default it uses sqlite3 for database
rails -d mysql
rails -d mysql new
Run this command and type Y when prompted for.
rails -d mysql new
exists
exists app/controllers
exists app/helpers
exists app/models
exists app/views/layouts
exists config/environments
exists config/initializers
exists config/locales
exists db
exists doc
exists lib
exists lib/tasks
exists log
exists public/images
exists public/javascripts
exists public/stylesheets
exists script/performance
exists test/fixtures
exists test/functional
exists test/integration
exists test/performance
exists test/unit
exists vendor
exists vendor/plugins
exists tmp/sessions
exists tmp/sockets
exists tmp/cache
exists tmp/pids
identical Rakefile
identical README
identical app/controllers/application_controller.rb
identical app/helpers/application_helper.rb
overwrite config/database.yml? (enter "h" for help) [Ynaqdh] y
force config/database.yml
identical config/routes.rb
identical config/locales/en.yml
identical db/seeds.rb
identical config/initializers/backtrace_silencers.rb
identical config/initializers/inflections.rb
identical config/initializers/mime_types.rb
identical config/initializers/new_rails_defaults.rb
overwrite config/initializers/session_store.rb? (enter "h" for help) [Ynaqdh] y
force config/initializers/session_store.rb
identical config/environment.rb
identical config/boot.rb
identical config/environments/production.rb
identical config/environments/development.rb
identical config/environments/test.rb
identical script/about
identical script/console
identical script/dbconsole
identical script/destroy
identical script/generate
identical script/runner
identical script/server
identical script/plugin
identical script/performance/benchmarker
identical script/performance/profiler
identical test/test_helper.rb
identical test/performance/browsing_test.rb
identical public/404.html
identical public/422.html
identical public/500.html
identical public/index.html
identical public/favicon.ico
identical public/robots.txt
identical public/images/rails.png
identical public/javascripts/prototype.js
identical public/javascripts/effects.js
identical public/javascripts/dragdrop.js
identical public/javascripts/controls.js
identical public/javascripts/application.js
identical doc/README_FOR_APP
identical log/server.log
identical log/production.log
identical log/development.log
identical log/test.log
This will make the changes in config/database.yml to make it use mysql database
config/initializers/session_store.rb
just a change in the secret key.
< :secret => '7b283a09779d9ac15dc4e3a667cf542470fcf123fc36f62226162b46812d89e2d
67e2de69d68534bc06d40be27b82f032d89bad4ac46ed7aaa9f1d879dfd6846'
---
> :secret => '00fd74b40cf6bfe681d109e3ef3a92629a76b032c8c7d1558ef180eea93f5d43a
755957c89df07e19b87a4a7eb3c962c77750f022109259473dbbcc84ed6719f'
To run your first application
ruby script/server
=> Booting Mongrel
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Type http://0.0.0.0:3000 to see your first application running. If you are using a remote server use server ip instead of 0.0.0.0 so you should type http://ip.add.re.ss:3000
It is using mongrel web server to server the requests. The application run in debug mode by default.
# rails
# rails new
create
create app/controllers
create app/helpers
create app/models
create app/views/layouts
create config/environments
create config/initializers
create config/locales
create db
create doc
create lib
create lib/tasks
create log
create public/images
create public/javascripts
create public/stylesheets
create script/performance
create test/fixtures
create test/functional
create test/integration
create test/performance
create test/unit
create vendor
create vendor/plugins
create tmp/sessions
create tmp/sockets
create tmp/cache
create tmp/pids
create Rakefile
create README
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
create config/database.yml
create config/routes.rb
create config/locales/en.yml
create db/seeds.rb
create config/initializers/backtrace_silencers.rb
create config/initializers/inflections.rb
create config/initializers/mime_types.rb
create config/initializers/new_rails_defaults.rb
create config/initializers/session_store.rb
create config/environment.rb
create config/boot.rb
create config/environments/production.rb
create config/environments/development.rb
create config/environments/test.rb
create script/about
create script/console
create script/dbconsole
create script/destroy
create script/generate
create script/runner
create script/server
create script/plugin
create script/performance/benchmarker
create script/performance/profiler
create test/test_helper.rb
create test/performance/browsing_test.rb
create public/404.html
create public/422.html
create public/500.html
create public/index.html
create public/favicon.ico
create public/robots.txt
create public/images/rails.png
create public/javascripts/prototype.js
create public/javascripts/effects.js
create public/javascripts/dragdrop.js
create public/javascripts/controls.js
create public/javascripts/application.js
create doc/README_FOR_APP
create log/server.log
create log/production.log
create log/development.log
create log/test.log
By default it uses sqlite3 for database
To use mysql database
rails -d mysql
rails -d mysql new
Run this command and type Y when prompted for.
rails -d mysql new
exists
exists app/controllers
exists app/helpers
exists app/models
exists app/views/layouts
exists config/environments
exists config/initializers
exists config/locales
exists db
exists doc
exists lib
exists lib/tasks
exists log
exists public/images
exists public/javascripts
exists public/stylesheets
exists script/performance
exists test/fixtures
exists test/functional
exists test/integration
exists test/performance
exists test/unit
exists vendor
exists vendor/plugins
exists tmp/sessions
exists tmp/sockets
exists tmp/cache
exists tmp/pids
identical Rakefile
identical README
identical app/controllers/application_controller.rb
identical app/helpers/application_helper.rb
overwrite config/database.yml? (enter "h" for help) [Ynaqdh] y
force config/database.yml
identical config/routes.rb
identical config/locales/en.yml
identical db/seeds.rb
identical config/initializers/backtrace_silencers.rb
identical config/initializers/inflections.rb
identical config/initializers/mime_types.rb
identical config/initializers/new_rails_defaults.rb
overwrite config/initializers/session_store.rb? (enter "h" for help) [Ynaqdh] y
force config/initializers/session_store.rb
identical config/environment.rb
identical config/boot.rb
identical config/environments/production.rb
identical config/environments/development.rb
identical config/environments/test.rb
identical script/about
identical script/console
identical script/dbconsole
identical script/destroy
identical script/generate
identical script/runner
identical script/server
identical script/plugin
identical script/performance/benchmarker
identical script/performance/profiler
identical test/test_helper.rb
identical test/performance/browsing_test.rb
identical public/404.html
identical public/422.html
identical public/500.html
identical public/index.html
identical public/favicon.ico
identical public/robots.txt
identical public/images/rails.png
identical public/javascripts/prototype.js
identical public/javascripts/effects.js
identical public/javascripts/dragdrop.js
identical public/javascripts/controls.js
identical public/javascripts/application.js
identical doc/README_FOR_APP
identical log/server.log
identical log/production.log
identical log/development.log
identical log/test.log
This will make the changes in config/database.yml to make it use mysql database
config/initializers/session_store.rb
just a change in the secret key.
< :secret => '7b283a09779d9ac15dc4e3a667cf542470fcf123fc36f62226162b46812d89e2d
67e2de69d68534bc06d40be27b82f032d89bad4ac46ed7aaa9f1d879dfd6846'
---
> :secret => '00fd74b40cf6bfe681d109e3ef3a92629a76b032c8c7d1558ef180eea93f5d43a
755957c89df07e19b87a4a7eb3c962c77750f022109259473dbbcc84ed6719f'
To run your first application
ruby script/server
=> Booting Mongrel
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Type http://0.0.0.0:3000 to see your first application running. If you are using a remote server use server ip instead of 0.0.0.0 so you should type http://ip.add.re.ss:3000
It is using mongrel web server to server the requests. The application run in debug mode by default.