November 20th, 2007, 02:04 PM
Embed Ruby On Rails
Okay, so I first consulted google and did not really find my answer.
In php, to call my code I imbed it in <?php ?> tags. How do you do this for Ruby? I tried looking up examples, but all I found was raw code.
November 20th, 2007, 02:15 PM
Here is a quick example:
<% for column in Contact.content_columns %>
<td><%=h contact.send(column.name) %></td>
<% end %>
Source of example:
November 20th, 2007, 03:03 PM
Oooh, okay, I get it, thanx a lot
November 21st, 2007, 09:26 PM
Sorry to double post..
When I have my html document, and I am uploading to hosting that offers ruby on rails.
outputs a very raw text string that literally says <% print "text" %>
<% print "text" %>
I am trying to find guides, but they all seem to walk through what looks like installation of RoR or something. All I know is I want to simply use the code in the website for simple tasks, not create and interface with databases, which all the guides I find seem to want to show me. The guides I find also look like the code is being preformed from a console, which I am not interested in.
December 5th, 2007, 11:41 PM
Hi, the majority of web based Ruby development is done using a framework called Ruby on Rails - or RoR. Rails is a plugin for Ruby. While Ruby has basic CGI stuff, RoR gives you a much better interface for building dynamic websites. Your host will have support for RoR built in, probably. It is RoR that alows you to do <%="hello"%> in your HTML. With RoR, you usually create your project offline (it includes a no-install-required web server), so you can build and test offline, then upload your project to the server to go live. In the long run, RoR will offer you *immense benifits* over trying to do HTML with Ruby. I suggest you look at a couple of RoR tutorials. RoR essentially gives you what PHP gives you, but SO much more.