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 ?
Tags: Directory Structure, Good Understanding, Patrick Lenz, Rhtml, Ror, Ruby on Rails, Ruby Scripts, Static Html, Web Applications


May 31st, 2008 at 11:28 pm
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:
June 3rd, 2008 at 12:30 pm
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
June 18th, 2008 at 12:22 pm
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/pages/test/one it will render the template app/views/pages/test/one http://www.yoururl.com/pages/about_us would render app/views/pages/about_us