Ruby on Rails - Simple Test Application

Create the application from cpanel,
for example:
Application name : example


Generate the test controller, via SSH:

    #cd /home/username/public_html/example/
    #ruby script/generate controller home

Create corresponding directory to store views, via SSH:

    #cd /home/username/public_html/example/appl/views/
    # mkdir home
    # vi index.rhtml
    <h1>Welcome</h1>
    And save index.rhtml file.
    #cd ..
    #chown -R username:username home

Start the application
You can access the application from http://domainname:port/home/

When you access the URL http://domainname:port, the default ruby welcome page will be displayed.
If you want to see the application on the main page, set the corresponding route in the configuration file routes.rb.

For example: In the above test application example, to display the welcome page of our home controller, instead of rails welcome page, uncomment and change the following line in routes.rb
(home/username/public_html/example/config/routes.rb).

map.root :controller => “welcome”
==> map.root :controller => “home”

Move the default rails welcome index file “/home/username/public_html/example/public/index.html” to another name(index.html.bak) or you can remove the file.

Now you can access the home page from http://domainname:port

  • 4 Users Found This Useful
Was this answer helpful?

Related Articles

RoR Support Test

Question: How do I check Ruby on Rails is activated ? Answer: In our Ruby on Rails support you...

Creating and running Ruby on Rails application through cPanel

Creating and Running a Ruby On Rails application in cPanelSteps:   1. Login to cPanel....