How Ruby on Rails Turns Ruby into Websites
See where your new skills lead
You have now learned the core building blocks of Ruby: printing output, variables, strings, numbers, arrays, hashes, conditionals, loops, methods, blocks, and symbols. In this final lesson, you will see how these same building blocks come together inside Ruby on Rails to build real, working websites.
What Rails actually is
Ruby on Rails, usually just called Rails, is not a separate language. It is a large collection of Ruby code, organized into a framework, that handles many of the repetitive tasks involved in building a website, so you can focus on what makes your website unique.
Models: your data, as Ruby objects
In a Rails application, information like users or blog posts is represented using something called a model, built using Ruby classes. The data inside it is stored very much like the hashes you already know.
user = User.new(name: "Ava", age: 12)
puts user.nameNotice the familiar symbol keys, name: and age:, doing the same job here that they did in your own hashes.
Controllers and views: your methods and loops at work
When someone visits a page on a Rails website, a piece of code called a controller decides what should happen. A controller is really just a collection of methods, exactly like the ones you learned to write.
def show
@user = User.find(params[:id])
endThe visual part of a page, called a view, often needs to display a whole list of things, and Rails views use the very same .each loop you already practiced.
@products.each do |product|
puts product.name
endWhy learning plain Ruby first was worth it
Rails can feel like a lot to learn all at once, with new folders, files, and conventions. But every piece of Rails is still built from the plain Ruby you have practiced in this course. Learning it well first means Rails will feel like a natural next step, not a completely new language.
If you enjoyed this course, the natural next step is learning Ruby on Rails itself, where you will see these exact building blocks used to build real, live websites.
Congratulations on completing Ruby for Beginners. You now have a solid foundation in one of the most readable and beginner-friendly programming languages in the world.
Quick check
Q1 What is Ruby on Rails?
Q2 In Rails, what is a controller mostly made up of?
Want to save your progress? It's free.
Create a free account