Showing posts with label rails. Show all posts
Showing posts with label rails. Show all posts

Wednesday, September 3, 2008

Installing Ruby and Rails on Ubuntu

Ruby is not installed on Ubuntu out of the box. To get Rails working you will need to install ruby and some other things first. Simply enter following line on shell prompt

sudo apt-get install ruby ruby1.8-dev irb rubygems build-essential libopenssl-ruby

This will install ruby and ruby gems on your machine. To install rails enter following on shell prompt

sudo gem install rails rake mongrel


this will install rails and mongrel, a rails web server, on your system. If you dont need mongrel you can remove mongrel from the above line.

Sunday, June 15, 2008

Sqlite3 with Rails

Sqlite3 is an easy to use DBMS available as a library. It is a self contained and server less SQL database engine. Because of its ease of use and small foot print it has become DBMS of choice for low traffic web applications.
Using Sqlite3 with rails is real easy. Grab the binaries from Sqlite3 download page. for windows you will require sqlite-3_5_9.zip and sqlitedll-3_5_9.zip. Unzip these files and add them to your PATH environment variable ( or u can simply put the unzipped files to your ruby/bin directory) and you are ready. All Sqlite3 functionality is accessible via sqlite3.exe which you just unzipped and added to path.
To use sqlite3 with rails install sqlite3-ruby gem using gem command. Finally you will need to specify sqlite3 as the connection in the database.yml file of your rails application. Given below is development section of a sample database.yml

development:
adapter: sqlite3
database: db/development.sqlite3
timeout: 5000

Notice that there is no username or password fields as they are not required.
When you do rake db:migrate database file will be created if not already exists.

Note: as of rails 2.0 sqlite3 is the default database and you will need to -d command line option when creating a rails application using to change it or you will need to change database.yml manually.