Category Archives: Rails

Rails – Stop the Rails Web Server by Command

The following command could start the Rails daemon server for you Rails web application.

  • rails s

 

Stopping the web server could be done by simply enter the Ctrl + C command in the terminal. But if your terminal session is disconnected, you have no way to stop the service. In that case, you have to kill the process directly. Continue reading Rails – Stop the Rails Web Server by Command

Rails – Switching Rails Environments Among Development, Test and Production

The following commands are run in Rails 3.

Run rails server:

# By default, rails console run in development env
rails server

# Run in test env
rails server --environment test

# Run in production env
rails server --environment production

Continue reading Rails – Switching Rails Environments Among Development, Test and Production

Rails – Running RSpec with Spork Test Server

I am still continuing the tutorial @ Ruby on Rails Tutorial by Michael Hartl

Last time we have integrated the RSpec and Autotest in Rails 3.
Rails – Integrate Autotest and RSpec in Linux
 

But it seems that it takes quite long for RSpec to complete the tests. This is because RSpec reloads the entire Rails environment for each run. Spork Test Server helps you preloading the Rails environment which greatly reduces the time for running the test suite.

1. Add the spork gem in the Gemfile Continue reading Rails – Running RSpec with Spork Test Server

Git – Initialize your Local Git Repository

Rails project works well with Git. A .gitignore file can be found in a freshly created Rails project. It would be good to setup the local Git repository before you start the development.

1. First, install Git

  • apt-get install git-core

 

2. Setup your Git user account.

  • git config –global user.name “Your Name”
  • git config –global user.email youremail@example.com

Continue reading Git – Initialize your Local Git Repository

Rails – Integrate Autotest and RSpec in Linux

I am learning Rails 3 @ Ruby on Rails Tutorial by Michael Hartl. A very nice and detail tutorial with many examples for beginners. Highly recommended.

But i got some problems when i tried to setup the Autotest for the RSpec framework. Autotest is a continuous testing tool which run the test suite automatically based on the files you have changed. RSpec is a Behavior Driven Development (BDD) framework for Ruby. After a few hours of struggling, i finally made it work.

1. Create a new Rails project without the default Test::Unit framework.

  • rails new sample_app -T

Continue reading Rails – Integrate Autotest and RSpec in Linux

Rails – Installation on Ubuntu Lucid

Last time we complete the Ruby 1.9.2 installation on Ubuntu Lucid.
Ruby – Installation on Ubuntu Lucid

Similar to the above post, run the following commands in your own account but not root account. Let’s proceed to the Rails 3.0 installation now.

1. Install Rails 3.0

  • gem install i18n tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler
  • gem install rails

Continue reading Rails – Installation on Ubuntu Lucid