Tuesday, July 04, 2006

Verifying Rails Installation

When you install the Rails framework, you also get a new command-line tool, rails, which is used to construct each new Rails application that you write. The rails command creates the right directory structure for you and populates it with some standard Rails code.

We shall create a very small web application to verify our Rails installation.

Open a command window and navigate to a place in your filesystem where you would want to create your application's directory structure. I am creating it in a folder called work and the path on my machine is c:/rails/work Switch to the work folder and use the rails command to create an application called demo, as follows.
c:/rails/work>rails demo

The command has created a directory named demo. Within the demo folder there are many other folders and files created for you. Amongst all of this, you will find a folder called script, that contains some utility scripts that we will be using as we develop our application. For now, we will use the server script that starts a stand-alone web server that can run our newly created Rail application under WEBrick (this is a pure-Ruby web server that comes along with Ruby). So type the command:
c:/rails/work/demo>ruby script/server

We have just started a web server at port 3000. We can now access the application by pointing a browser at http://localhost:3000
You can press control-C to stop WEBrick.

First Post | Previous | Next

Technorati Tags:
Blogs linking to this article


Blogger raj said...

Yes I am getting the page telling that: Welcome Aboard-You are riding Rails!!
>> Do I need to run RoR always through WEBrick server and if so, how are we going to configure it for other than the localhost(i.e how exactly we can run an application thr some remote address such as http://xyzdomain.com.)?

12:51 PM  
Blogger Ashish Kulkarni said...


That is where a WebServer like Apache comes into play. It resolves incoming domain requests to individual applications.

Other option is to run ROR on port 80 instead of 3000.

And then, to test, add the following entry into your Windows Hosts file:

xyzdomain.com localhost

This will redirect any requests for xyzdomain.com to localhost.


I have got the welcome page.

I am aware of how Apache can be configured to run with Tomcat. Is there any documentation around how this can be done for ROR?



3:25 PM  
Blogger SatishTalim said...

For Apache, refer page 455 of the book 'Agile Web Development with Rails'

3:56 PM  
Blogger sandip said...

This is something diff from our current training.
I want to know how to write the SQL query into the Ruby code, i dont want to use sql query in the code to retrieve data from database, i want ruby code to retrive the data. (I heared from some one is, this is possible in ruby.)
code: Video.find_by_sql("SELECT
Count(`videos`.`id`) AS `uploads`,
`users`.`name` AS `uploader`,
`users`.`photo_url` AS `Photo`,
`users`.`id` AS `id`
`videos` ,
`videos`.`user_id` = `users`.`id`
`uploads` DESC ")

want to convert this query in to ruby format.

Can any one please help me if possible.


5:05 PM  
Blogger sandip said...

Hi All,
Best Ruby Language FAQ here.


11:14 AM  
Blogger SatishTalim said...

Sandip this link is already there in our List of Resources. However, if you read thro' the FAQ, it does not answer many questions being asked by our participants.

11:16 AM  
Blogger sandip said...

Ruby Quick reference.
Really helpful.


Yes Sir i dont know about this FAQ's that why i send the link.

11:35 AM  
Blogger SatishTalim said...

Sandip, the quick reference link seems to be good. Will have a look.

11:48 AM  
Blogger sandip said...

Hi All,

Setting up a Rails Development Environment on Windows Using Eclipse.



3:24 PM  
Blogger Gaurav V Bagga said...


i have been hearing a lot of book "Agile Web Development With Rails" ,how to get this book for free as buying it in $$$ does not seems viable

any suggestions!

what can be done......

5:49 PM  
Blogger Anish Betawadkar said...

Done with the verification.

12:22 PM  

Post a Comment

Links to this post:

Create a Link

<< Home