If you are new to the world of building websites and web applications, it can be difficult to know which tools to use. There is an overwhelming amount of choices to make when attempting to turn your idea into a real working product.
Ruby on Rails is one of the most popular and widely used web frameworks today. Rails provides the foundation for building all kinds of websites and web applications and is behind some of the biggest and most popular modern online businesses.
Today is the first instalment of a new series on building web applications using Ruby on Rails.
What is Ruby and Ruby on Rails?
If this is the first time you’ve attempted to build a website or web application, you might not fully understand what I mean when I say Ruby and Ruby on Rails.
Ruby is a programming language that was created by Yukihiro “Matz” Matsumoto in the mid-1990s. It is a dynamic, object oriented programming language that is intended to be easy to read and write. If “dynamic” or “object oriented” don’t mean much to you write now, don’t worry, we will be covering many of the finer details of the Ruby programming language.
Ruby on Rails is a web application framework created by David Heinemeier Hansson (“DHH”) and is built on top of the Ruby programming language. Rails is a framework of components and abstractions that deal with the common structure and patterns of websites and web applications.
Using a framework like Rails means you don’t have to worry about building the common foundation for each project. Instead, you are free to concentrate on only what is important about your project.
This means that many of the most common components of building a website or web application have already been created for you to use.
Why should you learn Ruby and Ruby on Rails?
As I mentioned at the top of this post, there are many choices when it comes to choosing the right tools to build websites and web applications.
So why should you learn Ruby and Ruby on Rails?
Ruby is a great first language to pick up because there is a plethora of online resource, tutorials, and screencasts for all levels and interests.
The Ruby community is also one of the most active and well supported programming communities with a whole host of open source libraries, services, and companies ready to help you take your project from hobby to a really successful business.
Ruby is also a very highly demanded skill. By learning Ruby you will have job prospects all over the world.
Ruby on Rails will deal with a lot of the headaches you will encounter when attempting to build a website or web application. Rails uses “Convention over Configuration” to make your experience of using the framework as enjoyable as possible.
There are also thousands of open source packages that will slot straight into your Rails project so you don’t have to reinvent the wheel.
If you are unsure of what to learn in order to turn your idea into reality or to improve your job prospects for a career in programming, learning Ruby and Ruby on Rails is still an excellent choice in 2015.
Installing Ruby and Ruby on Rails
In order to work with Ruby on your computer, you first need to install it.
By default Ruby will already be installed on most distributions of Linux as well as OS X.
If you are running Windows you will need to use the Ruby Installer. I’ve never installed Ruby on Windows, but I’m sure there will be many tutorials and articles for doing so on the Internet.
The Ruby language is constantly evolving and so over your career you will more than likely need to run multiple versions of Ruby on your computer.
Once you have rbenv installed, choose and install a version of Ruby (Installing Ruby Versions).
Finally we can install the
gem install rails
Once that process is finished you should be able to run the following command without error:
Creating a new Ruby on Rails project
Now that you have Ruby and Rails installed on your computer, it’s time to create a new Rails project.
Go to the directory where you want to store your project. For me this is usually
Next run the following command (where
project_name is the name of your project):
rails new project_name
This process will automatically create all of the files you will need as part of your new Rails project.
Once the process has finished, move into your new project directory:
Launching your project for the first time
Congratulations! You’ve just created your first working Ruby on Rails project!
The files that were generated as part of the new project process is a fully working installation of Ruby on Rails that you can view in a browser.
From the command line, run:
This will boot up a local web server that can run your new Rails project on your computer.
Once the web server has started, navigate to
http://localhost:3000 in your browser to view your Rails project.
You should be greeted with the “Welcome to Rails” home page. If this all works correctly it means the process of generating a new Rails project was successful.
There is a lot to take in when creating websites and web applications, especially if this is your first time learning to code.
Ruby and Ruby on Rails is a great first choice, but there is still a lot of things to learn.
Today was the first step on a long journey go learning how to build websites and web applications.
We will be covering everything you need to know to become a programmer and to build successful ruby on rails websites and web applications. Sign up to my email list so you don’t miss a post!