How are website with Ruby on Rails built?

RobbDogg asked: I’ve gone throu the Sitepoint book “Build Your Own Ruby on Rails Web Applications” by Patrick Lenz, and have a good understanding of how web applications are built, but I don’t understand how an entire website is built using RoR. Is every page gernerated by one or more Ruby scripts or are their static HTML or RHTML pages that use a small amount of Ruby code to pull content from a database? I’m working on a site that uses PHP, but would like to convert it to RoR. Most of the pages use PHP to generate some content from infomation fetched from a database, and are fairly static except for the small part of the page that gets it content form the database. Would you use Ruby the same way you use PHP? Where would I put my website page files in the Ruby directory structure? under rails_root/public ?

3 thoughts on “How are website with Ruby on Rails built?

  1. It seems like you are missing a few key fundamental concepts.. i.e., tried to dive straight into advanced topics without learning the basics. Try going through the three “getting started with RoR” tutorials that the RoR website recommends:

  2. Hi,

    I have done this on hostingrails.com, you put these files in public_html directory, then create a sub-domain like yourapp.yourdomain.com.

    My customer updates the static files using front page, the ruby on rails application files sit in their application folder. One drawback is that I had to copy some of the style sheet info and the java script menu, but that wasn’t so bad. On other pages, i put some of the application in an iframe.

    In this way, you can even deploy multiple rails applications with one hosting provider account, see more in the link below.

    Success !

    Ambrosia

  3. You can use a controller to handle normal pages. For example in routes add:

    map.connect ‘*path’, :controller => ‘pages’, :action => ‘show’

    Then add a pages controller:

    class PagesController render_path
    end
    end

    Then when you call http://www.yoururl.com/page… it will render the template app/views/pages/test/one http://www.yoururl.com/page… would render app/views/pages/about_us

Leave a Reply

Your email address will not be published. Required fields are marked *