Exploring Ruby on Rails
The framework of Rails is an application that will spoil you. It has many surprises that will create your application very quickly, but before you can get spoiled with the quick way of the magic of rails as they called it. Let drive in and understand how Ruby on Rails is form.
The main importance of MVC stands for Model, View, and Controller is the heart of creating in ruby on rails.
A firm grounding in the model-view-controller (MCV) architectural pattern, which separates an application’s logic, located in models, from the presentation and routing of application information.
- Model (ActiveRecord) handles relationships, validations, and logic
- View (actionView) — renders view, uses embedded Ruby for templating
- Controller (ActionController)- controls which view to use, makes data available as instance variables ex: @movies. Contains several actions/defs and controls rendering and redirection.
My project is a Movie Review. The user can post and comment on Movie’s that is posted.
In my Model it shows have the has_many :through
What is has_many :through in Ruby on Rails
The has_many :through let us join table in the database (model) . In order to allow changes in the database they need to share a relation to connect.
Also, going along with has_many :through will be the nested associations.
Nested associations are found in config/routes
my nested: “ resources :do
What really help me in my journey with my project is the skill to “google” Even when I thought it was an easy method, I still google to help me understand it even more.