“Hello, World” Web Application in Ruby on Rails using Aptana Studio
I am assuming that you have everything properly setup on your computer for developing applications with the Ruby on Rails framework using Aptana Studio IDE. If not, see my previous posts:
- Setting Up Rails Development Environment on Windows Vista/XP
- Setting Up Rails Development Environment using Aptana Studio
In this post I will take you through a screenshot guided tour of the Aptana Studio (RadRails) IDE and show you how to develop a blank web application using Ruby on Rails framework and add a simple scaffold to it(“Hello, World” equivalent for Rails framework). So let’s get started.
When you run the Aptana Studio application, you will see the splash screen as shown below:
To create a new Ruby on Rails project, go to File -> New -> Project… and select Rails Project from the “Rails” folder(expand it if necessary). Enter a name for the project(say “Demo1″) and click Finish.
Below you can see the screenshots of various sections of the main window shown above:
The Project pane on the left:
The Console window at the bottom:
The Scripts window at the right(you can access the same from the “Scripts” menu too):
The Cheat Sheets window at the extreme right:
If you click the “Click to Begin” link in the cheatsheet window(shown above), you will see the following “Dynamuc Help” window with links to various Rails help topics:
Aptana Studio supports the following views that you can enable, for example to view API documentation, try out some regular expressions etc.:
At the bottom, you can click on RubyGems tab to see a list of Ruby gems:
You might be prompted to install some Ruby gems by Aptana Studio(you can install or ignore them):
RailsPlugins tab will show you the Rails plugins that you can install with a few simple mouse clicks:
RakeTasks tab allows you to perform various rake tasks by selecting the one you want from the drop-down box:
Generators tab similarly allows you to generate a scaffold, model, controller, view etc. by selecting the appropriate option from the drop-down box:
Creating a Blank Rails Web Application using Aptana Studio
Let us put the Generators tab to use. Select “Scaffold” from the “Generator” dropdown box, enter the parameters as shown in the screenshot below and press the “Go” button.
You should see the following output in the Console tab.
You should be able to see the following migration file generated in the project directory:
And here is a screenshot showing the contents of the generated migration file:
If you now run the rake tasks “db:create:all” and “db:migrate” you should be able to see the output of commands executed in the console window:
Now run the application. You should see the following output in the internal web browser of Aptana Studio:
Click on the “New Book” link and you will see the new book form like this:
You can go back to your Rails project, make edits, generate more scaffolds, models, controllers and views and test your changes in the internal browser of Aptana Studio. And so on and so forth.
Aptana Studio IDE with RadRails plugins provides one of the richest web application development environments for Ruby on Rails framework. NetBeans 6.1, emacs/vim, IntelliJ IDEA are pretty good too and all of these are multi-platform, so why bother with Mac-only solution like Textmate? ;)