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.