Magic Controller Actions

Why Controller actions magic

The Controller action is the C in MVC, which stands for Model, View, Controller. This part of the MVC helps determine what your route will look like, or what action it will do backed by a method in your view file. The ruby on rails comes with the controller actions in order to make your site look more dynamic or more pleasing to the programmer’s eye. This part of the MVC helps users interact with your site more.

Receiving requests or requestus

Once the controller action receives the requests created by the user this will go through the model straight to the view and render the action established in a controller. This part of the process is viewed as the middle man. For example, if there is an instance variable (@variable) in the show method it can be accessed in the view action to display what the user wants. This method can edit delete or update a feature. If a user adds a new method the controller action will have it in the views folder labeled as new.html.erb.

Parameters or parametorous

The parameters give users access to the data that has keys, hashes, and URL data. Query string parameters are part of the URL that the user has access to. The form data that is fired in the controller action is what’s known as post data this information usually comes from an HTML form and shows the users what’s going on behind the hood with the help of a byebug of course.

Sorry for spoiling the magic



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store