Tutorials

https://vvcestudio.com.br/en/tutorial/rubyonrails/
menu

Ruby on Rails

Runy

Ruby is a strong, dynamically typed, multi-paradigm interpreted programming language with automatic memory management. It is primarily object-oriented, but can also be functional.

Rails

Rails is a free framework that promises to increase speed and ease in developing database-driven websites, as it is possible to create applications based on pre-defined structures.

It's a great backend language.

Ruby On Rails code example
x
class HelloWorld
def self.hello(name = 'World')
   "Hello, #{name}!"
 end
end

Ruby is based on MVC.

Install Ruby

Install Ruby on Ubuntu
x
$ sudo apt-get install ruby-full
Rodar um codigo Ruby
x
$ ruby namefile.rb

Install Rails

Install Rails on Ubuntu
x
$ gem install rails
Start a Ruby on Rails project
x
$ rails new myapp
Run the project
x
$ rails server

Install Ruby on Rails on Windows:

The easiest way is to use rubyinstaller.
Download the installer from the website: https://rubyinstaller.org/
Download the version with DevKit.

Note: DevKit comes with the MSYS toolchan, comes with some libraries and allows compilation.

Run the installer.
Accept the license.
Choose the installation folder.
Check all options.
Leave it checked to run MSYS2 after installing Ruby.
When installing MSYS2, click enter twice.

Check the installed version
x
c:/meuprojeto/> ruby -v
Check installed gems
x
c:/meuprojeto/> gem list
to enter Ruby's interactive shell
x
c:/meuprojeto/> irb
irb(main) puts “Ola mundo.”

redirect 301 in Ruby on Rails

codigo redirect
x
def old_action
headers["Status"] = "301 Moved Permanently"
redirect_to "http://www.your-new-site.com.br/"
end
Logo Ruby On Rails