1
00:00:00,600 --> 00:00:01,880
Hello and welcome.

2
00:00:01,930 --> 00:00:15,760
In this lecture harbi Explaining what m c means what is MVC NBC basically stands for Mondo new controller.

3
00:00:16,110 --> 00:00:25,260
It's a principle or type of architecture that devised the work of an application into three separate

4
00:00:25,530 --> 00:00:29,270
but closely corporative subunits.

5
00:00:29,370 --> 00:00:35,290
So we've got the model view and the controller.

6
00:00:35,910 --> 00:00:38,360
Let's take a brief look at each of them.

7
00:00:38,360 --> 00:00:46,640
We start with the model the model basically contains the data for the application.

8
00:00:46,860 --> 00:00:52,510
So it's often linked to a database or behind the model.

9
00:00:52,560 --> 00:00:56,250
Always be a database that stores the data.

10
00:00:56,400 --> 00:01:04,950
The model contains all of things like the business all the business logic for the application is stored

11
00:01:05,190 --> 00:01:16,530
in the model and in Ruby on Rails application the model is actually the thing that looks after the work

12
00:01:16,530 --> 00:01:19,810
of the model is known as the active record.

13
00:01:19,830 --> 00:01:26,290
So the active record does the work of the model in a Ruby on Rails application.

14
00:01:26,300 --> 00:01:34,460
So it is the layer of the system responsible for representing the business data and the logic.

15
00:01:34,860 --> 00:01:42,870
So the active record will facilitate things like the creation and the use of business objects whose

16
00:01:42,870 --> 00:01:51,170
data requires persistence storage to a database so a model will always have a database to handle this

17
00:01:51,170 --> 00:01:52,080
storage.

18
00:01:52,320 --> 00:02:00,160
Next a look at The View review basically is used to present the data to the user.

19
00:02:00,540 --> 00:02:10,950
So the main purpose of the view in this architecture is to generate user interface and present the data

20
00:02:11,040 --> 00:02:11,900
to the user.

21
00:02:11,910 --> 00:02:18,490
So it's kind of like a passive for all that doesn't really do any processing behind the scene.

22
00:02:18,660 --> 00:02:25,990
All it does is present the data has a view to the user I mean we have the controller.

23
00:02:26,280 --> 00:02:34,130
So the controller basically in Ruby on Rails is the logical centre of the application.

24
00:02:34,150 --> 00:02:41,700
So it coordinates the interaction between the user view and the module.

25
00:02:42,060 --> 00:02:50,790
So when a request comes in for a website say for example someone typed in WWE Dort Instagram dot com.

26
00:02:51,150 --> 00:02:57,540
It is the controller that is responsible responsible for making sense of the request.

27
00:02:57,630 --> 00:03:05,130
Produce him the appropriate answer put to let's have a look at this a shot of how this would work.

28
00:03:05,340 --> 00:03:14,880
So we have somebody on the computer and they type in to their Web browser say wwor instagram dot com.

29
00:03:15,510 --> 00:03:20,520
What then happens that request gets passed to.

30
00:03:20,530 --> 00:03:23,940
He rails router Ruby on Rails.

31
00:03:24,330 --> 00:03:28,260
The rails are attached is kind of like a dispatcher.

32
00:03:28,560 --> 00:03:37,750
So when the request condee it looks like you are real and dispatches you are real to a controller the

33
00:03:38,000 --> 00:03:45,320
control and then takes a look and passes the request to the model.

34
00:03:45,930 --> 00:03:53,700
The model then queries the database for the information the database looks for the information passes

35
00:03:53,700 --> 00:03:59,000
it back to the model the model then passes the information back to the controller.

36
00:03:59,210 --> 00:04:07,610
The controller then passes the information to the view and the view then displays the data which is

37
00:04:07,620 --> 00:04:11,710
for example if the destination was Instagram.

38
00:04:11,730 --> 00:04:21,250
So that's how basically the MVC architecture works which is the architecture that rails employees.

39
00:04:21,510 --> 00:04:26,820
So it's good to have an understanding of how the model did view and controller works.

40
00:04:27,000 --> 00:04:33,240
So when you start working with it it gives you an idea of what's going on behind the scenes.

41
00:04:33,510 --> 00:04:38,420
So that's it for this brief introduction to MVC architecture.

42
00:04:38,670 --> 00:04:39,810
Thanks for watching.

43
00:04:39,810 --> 00:04:40,750
Bye for now.
