Rails Guide: Why Use Ruby On Rails
Ruby on Rails is a powerful, and some would say, amazing open-sourced framework for building web applications. Why use Ruby on Rails? Rails, short for Ruby on Rails, It is at the heart of many “Web 2.0” sites and developers love the ease of which you can create applications using Rails. It uses a ‘Convention over Configuration’ structure that reduces the amount of work for developers by eliminating vast amounts of configuration code, using naming conventions for folder and class names. All the tedious work of collecting data from a form, validating it, and then either writing it to the database or displaying error messages, is made unnecessary with a built-in system that makes a set of assumptions about how everything is named and organized. This allows Ruby on Rails to be simple without losing its flexibility in having customized applications. Many large companies such as Amazon, eBay, Basecamp, and Twitter have taken advantage of Ruby on Rails’ intelligent system for their projects.
This Rails lecture will give you a basic understanding of Ruby and why Ruby on Rails is highly regarded as a favorite amongst developers. In addition to terminology, background, and functions, you will learn why Ruby on Rails has gained so much popularity and acclaim for its intuitive structure. This first section will also focus on real and practical usage of the Ruby on Rails and go through the latest specifications. This course was developed for the beginner without any exposure to Ruby or Ruby on Rails, but a thorough knowledge of programming basics is a must for learning optimization.
In Chapter 1, Section 1, we’re going to learn what exactly will be on Rails and what it’s used for. Ruby on Rails, which I’ll be referring to as Rails, is an open-sourced framework for building powerful web applications. Rails is not a programming language. It’s a structure. It’s a framework to build web applications using the Ruby programming language. Ruby is the actual language, not Ruby on Rails.
Rails was created in 2004 by David Heinemeir Hansson, or among geeks, known as DHH. The Ruby language was created in 1993 so Rails came almost 10 years later, based on the Ruby language. Rails can work with multiple types of servers and databases. It can run on its own server, called WEBrick, but it can also run on Apache and other servers as well. And as far as databases, it comes with SQL Lite 3 as a default, which is modeled– it’s a server-less database, but it can also be used with MYSQL databases as well.
Rails is based on a model view controller design pattern, and in my opinion, one of the best design patterns available. It basically separates what the user sees – the HTML and the presentation – from the controllers, the routing system and also the business log-in which usually consists of database queries.
Rails is different from other web application frameworks in a couple of different ways. Rails claims that it’s the right way to develop web applications. Many of the hardcore Rail developers wouldn’t consider another way of developing, as far as the actual structure and framework of the application.
And there’s a popular phrase in the Rails community, which is ‘Convention over configuration’, and what this essentially means is that Rails tries to reduce the amount of work for developers, and it does this by having a strip set of naming conventions, as far as structure, as far as folder names and class names. There’s a really strict convention on naming, and it lets Rails be simple without losing its flexibility in having customized applications.
There’s a lot of other frameworks out there that utilize several configuration files, with a ton of settings and controls, so that would be a configuration-based system framework. They provide settings that are specific to each separate project and Rails really focuses on the naming convention over the configuration. So there’s less tedious work to do. There’s also less customized work to do, but you can still have customization, if you choose.
There’s a popular phrase amongst programmers called DRY, AKA ‘Don’t repeat yourself’ that makes Rails such an intuitive delight for everyone. Writing the same quote over and over, multiple times is not productive, and Rails was created for productivity. With Rails, ease of configuration and customizable options takes away the need to repeat code.
Rails runs independent of the web server. You can run Rails on multiple types of servers, such as Apache. It actually includes its own web server, which is called WEBrick, so you can run a local Rails server on any computer, and you don’t need to have WinAmp or anything like that. It just runs right on the machines that you have, which is very cool.
Rails looks at everything as an object and is very object oriented. Anything from strings to actual numbers are actually objects. You can even call methods a number. For instance there’s something called the times method – so you can have seven dot times, and that’s actually got to run whatever phrase or string you put in it seven times, so it’s very, very object-orientated. You can also create procedural types of applications as well, making it very flexible.
As mentioned before, Ruby is the programming language that Ruby on Rails runs. However, if you don’t know Ruby at all, you don’t have to worry because Ruby is a very easy language to learn. But what you should have a basic idea of is just programming in general. A lot of people actually learn Rails without any Ruby background and that’s fine, you can get by. You just need to really understand basic programming concepts like variables, functions or methods, conditionals, if statements, and other basic terms. Chapter 2 is all about Ruby, so we’ll actually be learning some of the language and some of the basic programming principles.
Now let’s move on to Windows and Linux. A lot of Rails developers will not work on Windows, just because Ruby and Ruby on Rails initially ran on Linux. It used to be a lot easier to run rails on Linux than Windows, but there has been a lot of developers that are now using Rails on Windows, due to these new kits that are available. One of the kits is this Windows Rails Installer, and you need a lot to run Ruby on Rails. You need SQL Lite. You need RubyGems. But this Rails Installer software actually lets us install it on any Windows machine extremely easily. It’s very, very easy. It’s basically just like installing any software on a Windows machine. You go through the installer, and then it gives you an actual command line to use. That means you can now do pretty much anything you can do in Linux. But more developers are starting to use Windows, and in this particular series, we will be focusing on Windows and dabbling in Linux as well.
I’m also going to show you how to install it on Linux Ubuntu. We’re actually going to show an optional video installing Linux Ubuntu onto a virtual machine if you’re interested in this in the future. And the other piece of software we’ll be using is Interactive Ruby, which is a program for Windows that will allow us to type Ruby right in the command line, just as if it was a Linux machine with Ruby installed.
RubyGems is a package manager for Ruby on Rails. It’s basically just little pieces of code that you can plug into your Ruby on Rails site. Rails itself is actually a Gem. Once you have RubyGems, you can use the syntax with the Gem installed, whatever the name of the Gem. It can look like modules or plugins or something like that, and I used to distribute Ruby-based programs in libraries. They’re just chunks of code that you can utilize in your application. It’s used as a tool to manage installation of Gems, just like the syntax, Gem uninstall and install, etc. RubyGems is part of the standard library from Ruby 1.9 on, and what we will be using is Ruby 1.9.3. Rails is a Gem itself. You can actually install Rails through RubyGems.
Top courses in Ruby on Rails
Ruby on Rails students also learn
Empower your team. Lead the industry.
Get a subscription to a library of online courses and digital learning tools for your organization with Udemy for Business.