C
C
CheshKin2015-09-10 11:30:24
Ruby on Rails
CheshKin, 2015-09-10 11:30:24

Is it possible to run the program on the site?

I'm new to Ruby, now it's time to get familiar with rails and I have a question. Is it possible to Run on the Rails engine, what we run through the terminal (.rb)?
Let's say this file. And if so, how? (where to put it in the app/assets folder?)

test.rb

require 'rubygems'
i = 0
num = 5
until $i > $num do
   puts "Hello World!"
$i +=1
end

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Mirilaczvili, 2015-09-10
@CheshKin

Wait a while with Ruby on Rails. In my experience it is quite difficult for beginners. It would be easier to start with the Sinatra framework

require 'sinatra'

get '/' do   # Путь '/' означает корневой путь в URL.
  "Hello World!"
end

If you run this web server program and open the page 127.0.0.1:4567 in your browser , you will see the text
"Hello World!"
But to practice working with Ruby, it is enough to run just Ruby scripts in the terminal:
ruby hello.rb

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question