HomeAboutBlogPortfolioTechNews Register Login

My Blog

As I have studied web development I have learned that there is a lot to know. Everytime I learn something new I realize there is much more I don't know. So here are some things I have learned along the way!

Rails MVC

Rails Backend

For this post I want to talk about the basic structure of Ruby on Rails. Rails is a MVC software architectural pattern. Where M stands for model, V for view, and C for controller. Most websites communicate with databases to pull information and display it to the user. There are some that do not and those are called static pages.


In order to control the information that is accessible from the database rails uses the MVC pattern. When a user types in a web address it first goes to your routes. Your routes will direct you to a controller. The controller like in its name controls a lot of the data flow of the application. It is the controller that will determine if the application will need to go to the database through the model to grab information or if it can just go directly and grab views to be displayed. If it wasn't for the controller it would be easy for a hacker to grab whatever information they want from the database. Some information may be sensitive. For example credit card information. Also the controller helps to keep hackers from dumping anything they want into your database. It is important that when you code out your controllers you use best practices for security measures. 


If the page that is being access is just a static page it will go straight to the views. Otherwise the controller tells the model what it wants the model then fetches it from he database and sends it back to the controller. The Rails framework is set to allow the views to be able to pull the information it needs from the corresponding method in the controller. I plan to discuss the controller methods in more detail in another post. The stylesheets which is typed in css code along with javascript and the views html code will display the page to the user in a nice and user. Hopefully in a well designed and user friendly format!


Jason Hall


this is a test
Comment posted by Jason over 2 years ago