Ruby programming language
Ruby
Ruby is a dynamic, open source scripting language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write. [1] Ruby is open-source, scripting language. It was developed in the mid 1990s, by Yukihiro “Matz” Matsumoto in Japan. It’s created using C programming language.
Example of simple Ruby code
|
|
This will create function which with one parameter name which will have default value of “World”. We can call it by providing only name hi and then it will use default value for name, or with parameter hi(“Jimmy”).
Ruby vs Ruby on Rails
Ruby is open source scripting lanaguage. Ruby on Rails is rather framework than programming language. Ruby on Rails can be used to streamline process of creating web pages which are using database. Ruby on Rails use MVC architecture. In the MVC architecture, MODEL is responsible for information/data and how to manipualte with that data. View is what user sees. Controller is managing between these two ‘boxes’. When user make request to our webpage, it goes to the Controller. Then Controller fetch some data from Model and represent them using View component to the final user.
To try and start with simple ruby on rails application we need to run just this code:
rails new [project-name]
By default it will use SQLite, but we can change that to database of choice using -d flag.
cd into that project, and you can run locally your website with
bin/rails server - from that directory.
Now we can access our server in web browser.
More about Ruby and Ruby on Rails you can find here:
Ruby on Rails guide, Ruby docs
[1] - Ruby lang