How views work in Ruby on Rails

We’ve all had the feeling where we write some code, it does what it’s supposed to and we think “how did I make that work?”.

“All the tutorials explain what is going on but nothing explains how it’s working”

“How come the variables that I’ve defined over here are now visible over there?”

“In other languages I had to write every line of code so I knew exactly what was going on – with Rails I have no idea how the interconnectedness works”

Ruby on Rails is a framework designed to make it ultra-simple to create database-powered web applications. It encourages you to follow a particular formula for organising your code and if you go along with its rules it can save you a huge amount of time and effort in getting your application up and running.

And while the stuff that it does is amazing, for someone new to Rails, sometimes it can feel like there’s just too much magic involved. It can be so hard to wrap your head around it.

Nowhere is this more apparent than with Rails view rendering.

Rails is built for producing web applications. An HTTP request comes in, Rails routes it to the a controller, the controller tells some models to do something, the controller invokes a view and it generates a HTTP response. But the whole process is magical. So much is implicit, so much just seems to happen by itself.

Have you ever wondered how Rails does it thing?

How come the variables in your controller magically appear in the view? How does Rails know which template to render? How does it know what to call and when?

If you want to know the answers to those questions and get a deeper understanding of how Rails’ magic actually works then this is for you. Rendering, templates, partials, forms and form-helpers – everything you need to know about Rails and views in one simple, easy to follow email course.

Just sign up below to access Rails’ secrets.

2 Comments How views work in Ruby on Rails

  1. Katyanna

    Good morning (:

    I really liked your blog, but the insistence on subscribing is upsetting.

    I mean, I had already subscribed once I saw that the content is good and then, besides the popups, comes this post that says nothing it promises (how views work, that’s what you’re promising to explain) and just asks me to subscribe.

    Please, understand that as a friendly feedback. Sorry if I sounded rude at some point, English is not my mother language.

    Thank you for the content.

  2. Rahoul Baruah


    Thanks for the feedback – basically it’s an email course that runs over five long articles. None really makes sense on its own, only as part of the bigger sequence. But I didn’t want to just send it out to existing subscribers in case they weren’t interested.


Comments are closed.