helloopensource

 

rubyonrails

Page history last edited by Paulo 1 yr ago

 

Hello Ruby On Rails using EasyEclipse

 

 

This Tutorial will show you how to download and install Ruby and the Rails framework. It end with a simple example of a rails program which uses a controller and a view in EasyEclipse

 

 

Main Learning's

 

After following this tutorial you will learn how to:

  • Download and install Ruby and Eclipse
  • Download and install Rails framework
  • Write and execute the Hello World Example for Ruby on Rails which uses a controller and a view.

 

 

Versions used:

  • OS: Windows XP SP2
  • EasyEclipse for Ruby on Rails 1.2.2.2

 

 

Tutorial Steps:

 

1. Visit http://easyeclipse.org/site/distributions/ruby-rails.html and download the the 112MB  easyeclipse-ruby-rails-1.2.2.2.exe file

2. Execute the file after download to run the EasyEclipse setup.

 

 

 

3. Accept the License Agreement to continue.

 

 

4. Choose the location and hit Install

 

 

5. The setup should being installing files onto the system.

 

 

 

6.0 Now you need to install Ruby Gems. Visit the website http://rubyforge.org/frs/?group_id=126 and download/open rubygems-0.9.4.zip

 

 

 

 

 

6.1 After Ruby gems has downloaded, open the file and click on desktop in the right window pane. Then hit ok. This should extract all the files on the desktop folder called rubygems-0.9.4

 

 

 

 

 

6.2 Run the setup.rb file, and gems should install.

 

 

 

 

7.1 After installation is complete, press Start>Run and type in cmd

 

 

7.2 Type "gem install rails --include-dependencies" to install rails. You must be connected to the internet to do this step.

 

 

 

8. Run EasyEclipse from the place where it is installed.

 

 

 

 

 

9. Choose your workspace

 

 

 

 

 

 

 

 

10. Right-mouse click on the empty area and choose New>Project

 

 

 

11. Choose Rails Project

 

 

 

 

 

12. Give the project a name.

 

 

 

 

Clicking on finish will create the project in the workspace

 

 

13. On the bottom left part of the environment, click on generators and choose "controller" and type "speak" in front of the controller to create a controller in the project.

 

 

 

 

 

 14. You should see speak_controller.rb class in your controller folder

 

 

 

 

 

 15. Type the following in your speakcontroller.rb file.

 

 

 

 

 

 16. In the views, right-click and choose New>Folder

 

 

 

 

 

 

 17. Create a speak folder in the views

 

 

 

 

 

18. Right-click on speak folder in the views and choose New>File to create a Hello view.

 

 

 

 

 

 

19. Type in hello.rhtml as the file name to represent the ruby html file.

 

 

 

 

 

20. Write the following in your hello.rhtml (which is in views/speak folder)

 

 

 

 

 

 

 

21. Right click on the project and chooose Run As< rails Application

 

 

 

 

22. The default index page will show up when the program runs

 

 

 

 

23. After you change the address bar and include speak/hello, you should see the message from the controller (where the variable text was set) and view.

 

 

 

 

Comments (0)

You don't have permission to comment on this page.