Newbie question

i am coming from php and dont seem to quite understand how ruby works
with the browser. how does one implement ruby code into html code?

You will need a framework like rails or sinatra to do web “stuff”. I
recommend taking a look at rails, there are a lot of good tutorials
online
to help get you started.

Buddy Lindsey

http://www.twitter.com/buddylindsey

Have a look at this;

http://www.sinatrarb.com/
http://www.sinatrarb.com/intro.html

Sam

ok, installed rails
gem install rails --include-dependencies
now what?

thank you guys, will take a look

On Wed, Aug 31, 2011 at 7:58 PM, Sam D. [email protected]
wrote:

i am coming from php and dont seem to quite understand how ruby works
with the browser. how does one implement ruby code into html code?

+1 for Sinatra

On Thu, Sep 1, 2011 at 3:10 AM, sunny parker [email protected] wrote:

ok, installed rails
gem install rails --include-dependencies
now what?


Phillip G.

phgaw.posterous.com | twitter.com/phgaw | gplus.to/phgaw

A method of solution is perfect if we can forsee from the start,
and even prove, that following that method we shall attain our aim.
– Leibniz

On Wed, Aug 31, 2011 at 7:52 PM, sunny parker [email protected] wrote:

i am coming from php and dont seem to quite understand how ruby works
with the browser. how does one implement ruby code into html code?

On Thu, Sep 1, 2011 at 2:56 AM, Buddy Lindsey, Jr. [email protected]
wrote:

You will need a framework like rails or sinatra to do web “stuff”.

Not necessarily. For simple tasks it might be sufficient to just use
Ruby’s built in class CGI

Kind regards

robert

On Thu, Sep 1, 2011 at 4:52 PM, sunny parker [email protected] wrote:

Not necessarily. For simple tasks it might be sufficient to just use
Ruby’s built in class CGI

but then how would i output using a browser?

You need a web server capable of using CGI interface. Any web server
should be able to do it these days.

Kind regards

robert

thank you

Robert K. wrote in post #1019588:

On Wed, Aug 31, 2011 at 7:52 PM, sunny parker [email protected] wrote:

i am coming from php and dont seem to quite understand how ruby works
with the browser. how does one implement ruby code into html code?

On Thu, Sep 1, 2011 at 2:56 AM, Buddy Lindsey, Jr. [email protected]
wrote:

You will need a framework like rails or sinatra to do web “stuff”.

Not necessarily. For simple tasks it might be sufficient to just use
Ruby’s built in class CGI

Kind regards

robert

but then how would i output using a browser?

A more general solution is:

#!/usr/bin/env ruby

had issues with this:

#!/usr/bin/ruby
puts “content-type: text/html\n\n”
puts “Hello World!”

fixed it with this:

#!/xampp-1.74/Ruby192/bin/ruby
puts “content-type: text/html\n\n”
puts “Hello World!”

The php equivalent is erb - embedded ruby. Rails and Sinatra are. More
equivalent to something like the cakephp framework.

Blog: http://random8.zenunit.com/
Twitter: http://twitter.com/random8r
Learn: http://sensei.zenunit.com/
New video up now at http://sensei.zenunit.com/
real fastcgi rails deploy process! Check it out now!