IT Staff

Blog về chuyên ngành IT

[Ruby on Rails] Starting to build new app

leave a comment »

Create my rail-app:

  $ rails new myApp     // In Simply_Rails_2: $ rails myApp

Next step if succeed, change into the myApp subdirectory

  $ cd myApp

Execute the bundle command:

  $ bundle install –without development test rmagick        

Next step if succeed,

Start the Mongrel webserver:

  $ rails s    // In Simply_Rails_2: $ ruby script/server

If succedd, the  result is below:

=> Booting WEBrick
=> Rails 3.2.3 application starting in development on
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2012-05-26 04:43:02] INFO  WEBrick 1.3.1
[2012-05-26 04:43:02] INFO  ruby 1.8.7 (2010-01-10) [i486-linux]
[2012-05-26 04:43:07] INFO  WEBrick::HTTPServer#start: pid=9994 port=3000

Go to the url http://localhost:3000, then the result is:

You’re riding Ruby on Rails!

I’ve met some errors when I run “rails s”, and find out the resolve for them. The details are:

[1]. Javascript not found:


[link ref:]

Example install:

  $ sudo apt-get install python-software-properties
  $ sudo apt-add-repository ppa:chris-lea/node.js
  $ sudo apt-get update
  $ sudo apt-get install nodejs npm

It installs current stable Node on the current stable ubuntu.

If you want to compile Node C++ modules:

  $ sudo apt-get install nodejs-dev

Or configure shell script for install node.js using

[2]. openssl not found


[link ref:]

  $ sudo apt-get install libopenssl-ruby1.8


[1]. The Gemfile

source ‘’

gem ‘rails’, ‘3.2.3’

# Bundle edge Rails instead:
# gem ‘rails’, :git => ‘git://’

gem ‘sqlite3’, ‘1.3.6’

gem ‘json’

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem ‘sass-rails’,   ‘~> 3.2.3’
  gem ‘coffee-rails’, ‘~> 3.2.1’

  # See for more supported runtimes
  # gem ‘therubyracer’, :platform => :ruby

  gem ‘uglifier’, ‘>= 1.0.3’

gem ‘jquery-rails’

# To use ActiveModel has_secure_password
# gem ‘bcrypt-ruby’, ‘~> 3.0.0’

# To use Jbuilder templates for JSON
# gem ‘jbuilder’

# Use unicorn as the app server
# gem ‘unicorn’

# Deploy with Capistrano
# gem ‘capistrano’

# To use debugger
# gem ‘ruby-debug’
“Gemfile” 39L, 785C                              1,1           All

[2] Rails Info Properties:


Ruby version 1.8.7 (i486-linux)
RubyGems version 1.8.24
Rack version 1.4
Rails version 3.2.3
JavaScript Runtime Node.js (V8)
Active Record version 3.2.3
Action Pack version 3.2.3
Active Resource version 3.2.3
Action Mailer version 3.2.3
Active Support version 3.2.3
  • ActionDispatch::Static
  • Rack::Lock
  • #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0xb6b9c394>
  • Rack::Runtime
  • Rack::MethodOverride
  • ActionDispatch::RequestId
  • Rails::Rack::Logger
  • ActionDispatch::ShowExceptions
  • ActionDispatch::DebugExceptions
  • ActionDispatch::RemoteIp
  • ActionDispatch::Reloader
  • ActionDispatch::Callbacks
  • ActiveRecord::ConnectionAdapters::ConnectionManagement
  • ActiveRecord::QueryCache
  • ActionDispatch::Cookies
  • ActionDispatch::Session::CookieStore
  • ActionDispatch::Flash
  • ActionDispatch::ParamsParser
  • ActionDispatch::Head
  • Rack::ConditionalGet
  • Rack::ETag
  • ActionDispatch::BestStandardsSupport
Application root /home/xavier/Code/Ruby/tutorial
Environment development
Database adapter sqlite3
Database schema version 0

Written by Xavier

Tháng Năm 26, 2012 lúc 9:05 sáng

Trả lời

Mời bạn điền thông tin vào ô dưới đây hoặc kích vào một biểu tượng để đăng nhập: Logo

Bạn đang bình luận bằng tài khoản Đăng xuất /  Thay đổi )

Google+ photo

Bạn đang bình luận bằng tài khoản Google+ Đăng xuất /  Thay đổi )

Twitter picture

Bạn đang bình luận bằng tài khoản Twitter Đăng xuất /  Thay đổi )

Facebook photo

Bạn đang bình luận bằng tài khoản Facebook Đăng xuất /  Thay đổi )

Connecting to %s

%d bloggers like this: