-1

I've read the tutorial but most are running rails guides on the web ?. I do not know how to run ruby on the web. help me !

  • 1
    It's not clear to me what exactly you are asking for. Do you mean you don't want to use ruby on rails, and are looking for some other framework instead? Or you are asking how to write a new one? – canoe Jan 06 '14 at 02:28
  • You really need to put more effort into your question.show us what you tried and read. What tutorial? The Internet is full of them. – the Tin Man Jan 06 '14 at 02:38
  • I want to run ruby as PHP (Apache), not consoles. But do not know how? – Thuan Truong Jan 06 '14 at 02:42
  • You can run rails just using web brick. Did you try something like http://stackoverflow.com/questions/9282689/allow-public-connections-to-local-ruby-on-rails-development-server ? – Noah Clark Jan 06 '14 at 18:35

2 Answers2

1

You want to run it as CGI? Or running inside a wrapper? It really sounds like you don't have a good starting knowledge. I'd STRONGLY recommend taking time to learn more about all the technologies needed, such as how browsers interpret HTML, how back-end systems send HTML, plus serve images, CSS and JavaScript.

Start with Ruby and Sinatra, then grow from there:

require 'sinatra'

get '/hi' do
  "Hello World!"
end

Load the Sinatra gem into your Ruby environment using gem install sinatra. Save the above code to a file, then run it using ruby /path/to/your/saved/file.rb. Follow the directions it outputs.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
0

Ruby, unlike PHP, was not built with web in mind. It was made as a general programming language that can run just about anywhere. So you can't just boot up Apache and run Ruby code.

With that said, it is still possible to run your own Ruby code online. All you would need to do is write a web server that can listen and translate your code to something that is view-able from a web browser.

I would suggest not creating your own as there are a number of services built. If you are looking for something to put your Ruby code online, but don't want something as large as rails, I would suggest using Sinatra.

Justin Wood
  • 9,941
  • 2
  • 33
  • 46