Search
Close this search box.
Search
Close this search box.

Ruby on Rails: The Beginning

Share This Post

 
As a programmer new to Ruby who has recently debunked the command line tools issue when starting with Ruby on a Mac you are now ready to begin in earnest your Ruby on Rails or RoR (you know how us Geeks love our acronyms) coding career.
The MVC programming pattern is used in Ruby on Rails and it can be a little confusing if you are new to programming in general or a veteran coder. The acronym M-V-C stands for Model-View-Controller and each has a specific function for your web application.

  • Model – Contains application data, logic, rules, functions
  • View – The visual representation of said data, rules, logic, etc.
  • Controller – Mediator between the Model and View

Ruby chart
If that seems a bit abstract to you let’s think of it in another way.  View – it’s your eyes. You see what is going on. What do you do with those visual elements? You pass them along your Controller / central nervous system until they get to your Model / brain.
So let’s say that your View is a large, angry looking ferret staring you down with its dark, beady eyes. After your controller has sent that data to your Model it will most likely tell you do adjust your view by turning and moving in a rapid speed in a different direction.
After you have eluded the wily ferret your View is a lovely picnic in front of a pristine lake. Your controller sends this new data to your Model and it decides to sit down and have a delicious avocado sandwich.
Now your view is that you are out of avocado sandwiches (oh no!). So you pass that data along the Controller to your Model which decides to go home (I mean what’s the point if you don’t have avocado right?)
If that analogy didn’t sit well with you perhaps a webpage will. The HTML would be the Model, the CSS the View and the browser the Controller.
This is my long-winded way of telling you that the Model is the data, logic, or information of your program. The View is the visual representation of it and the Controller is the traffic cop that directs them.
Hopefully this helps you understand the MVC pattern a little better and I will be back next month to continue our journey.

More To Explore

Current360 2024 Predictions crystal ball

2024 Predictions

Thanks to everyone who responded to our 2024 Predictions survey last month. While the sample size wasn’t quite the size of a Pew or Nielsen,

Tradition and digital media crown become digital

The King is dead.
Long Live the King.

No we’re not talking about Charles VII or his father Charles VI. Instead, we’re recognizing the passing of the baton after years of shifts from

Contact Us

"*" indicates required fields

I am not a robot
Ed Sharp Current360 headshot

Ed Sharp

Ed brings 15 years of traditional and digital media sales experience to the agency, giving us a perspective most agencies don’t have. When he’s not working or seeking new knowledge, Ed hangs out with his wife, two kids, two dogs, one cat, and a hamster. And yes, the cat and hamster are best friends.

Chaney Given

Chaney is a talented and accomplished designer and illustrator, who has expanded his skill set to include motion graphics and video editing. With nearly a decade of experience, his client work includes Waterstep, Baptist Health, the Archdiocese of Louisville Catholic Schools, First Harrison Bank, and many more