The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> Ruby Programming
|
Embed Ruby On Rails
Discuss Embed Ruby On Rails in the Ruby Programming forum on Dev Shed. Embed Ruby On Rails Ruby and Ruby on Rails programming forum covering Ruby Tips and Tricks, Best Practices, and agile development with Ruby on Rails.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

November 20th, 2007, 02:04 PM
|
|
Contributing User
|
|
Join Date: Nov 2004
Posts: 70
Time spent in forums: 9 h 54 m 11 sec
Reputation Power: 9
|
|
|
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
|
 |
Contributing User
|
|
|
|
|
Here is a quick example:
<% for column in Contact.content_columns %>
<td><%=h contact.send(column.name) %></td>
<% end %>
Source of example:
http://www-128.ibm.com/developerworks/linux/library/l-rubyrails/
|

November 20th, 2007, 03:03 PM
|
|
Contributing User
|
|
Join Date: Nov 2004
Posts: 70
Time spent in forums: 9 h 54 m 11 sec
Reputation Power: 9
|
|
|
Oooh, okay, I get it, thanx a lot
|

November 21st, 2007, 09:26 PM
|
|
Contributing User
|
|
Join Date: Nov 2004
Posts: 70
Time spent in forums: 9 h 54 m 11 sec
Reputation Power: 9
|
|
Sorry to double post..
When I have my html document, and I am uploading to hosting that offers ruby on rails.
Code:
<html>
<body>
<% print "text" %>
</body>
</html>
outputs a very raw text string that literally says <% 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
|
|
Registered User
|
|
Join Date: Dec 2007
Posts: 1
Time spent in forums: 9 m 47 sec
Reputation Power: 0
|
|
|
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.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|