1
00:00:00,690 --> 00:00:01,670
Hello and welcome.

2
00:00:01,710 --> 00:00:10,320
In this lecture we are going to list all of our post at the moment we can post or we don't have them

3
00:00:10,320 --> 00:00:10,830
listed.

4
00:00:10,830 --> 00:00:17,240
We want a way for the post to be listed on the home page.

5
00:00:17,340 --> 00:00:18,990
So currently this is what we have.

6
00:00:18,990 --> 00:00:23,970
So when you send the post this is what it displays that the hit.

7
00:00:23,970 --> 00:00:27,960
This one here is the title which is the H2.

8
00:00:28,210 --> 00:00:30,420
And this is the body variable.

9
00:00:30,460 --> 00:00:40,260
The is the text that was sent So we want a way of listing the or the post that has been submitted.

10
00:00:40,410 --> 00:00:48,980
Let's have a quick look at the results so that we know which rout we are looking here to use.

11
00:00:49,020 --> 00:00:49,390
So.

12
00:00:49,410 --> 00:00:54,820
So this is the routs here and this is what we want here.

13
00:00:54,840 --> 00:01:03,020
So we want the Post index we want the Post controller and the index action.

14
00:01:03,120 --> 00:01:04,900
So this is his post.

15
00:01:04,910 --> 00:01:05,480
Get it.

16
00:01:05,490 --> 00:01:13,520
Get all the posts and list them inside this action index action and the post controller.

17
00:01:13,740 --> 00:01:19,130
So let's go to the controller and amend the index for you.

18
00:01:19,170 --> 00:01:21,690
So I'm going to go.

19
00:01:21,750 --> 00:01:23,270
This is a controller here.

20
00:01:23,290 --> 00:01:26,000
This is a post on the score controller.

21
00:01:26,250 --> 00:01:32,430
So I just need to tab down and add a variable to that.

22
00:01:32,520 --> 00:01:37,560
So all I need to do is to at once.

23
00:01:39,470 --> 00:01:48,530
Kim said that to each course to post dot or.

24
00:01:51,020 --> 00:01:58,490
So the line I've added here is the fact that a variable this pulse variable and the said that two equals

25
00:01:58,490 --> 00:02:05,520
to the post model this upper case P is a plus model so as to get all the pause there is submit it is

26
00:02:05,540 --> 00:02:07,820
in the post model here.

27
00:02:07,820 --> 00:02:14,390
This would get it from the database everything I guess sent submitted this post model here.

28
00:02:14,410 --> 00:02:16,340
Get the more from the database.

29
00:02:16,350 --> 00:02:17,450
That's what that means.

30
00:02:17,570 --> 00:02:22,850
So let me say that now we need to go to our index at the moment.

31
00:02:22,850 --> 00:02:31,610
If I opened up the site you find just refer to the index.

32
00:02:31,790 --> 00:02:38,950
This is what the index looks like at the moment so we want all the post to be listed here in the index

33
00:02:38,990 --> 00:02:43,880
few so we need to make some changes to look in to the index template.

34
00:02:44,000 --> 00:02:49,860
So good to the templates we use on them for use on the polls.

35
00:02:49,870 --> 00:02:55,710
We've caught indexed top tier mount so we just need to edit this index story.

36
00:02:55,780 --> 00:02:57,950
Sh t e mail and e r b.

37
00:02:57,970 --> 00:03:01,110
Just need to amend this template.

38
00:03:01,300 --> 00:03:12,560
Alright so I know it is template so I just going change the text from hellowallet and change it to my

39
00:03:14,450 --> 00:03:19,620
blog post.

40
00:03:19,820 --> 00:03:23,730
Okay put the nest there.

41
00:03:25,300 --> 00:03:27,150
I missed out the closing time.

42
00:03:27,240 --> 00:03:28,670
Okay.

43
00:03:28,800 --> 00:03:36,820
In the next line I want to do is add an embedded Ruby to that.

44
00:03:36,950 --> 00:03:44,680
Bet do a percent sign and Space at.

45
00:03:44,740 --> 00:03:52,300
Send that to the post variable dot.

46
00:03:52,670 --> 00:03:57,010
Explain what it means in a minute space do.

47
00:03:57,540 --> 00:04:04,760
And then in between and when liquid pipes the pipe symbology toast next to Dizzy character switching

48
00:04:04,780 --> 00:04:06,420
between the pipe and will pass.

49
00:04:06,430 --> 00:04:08,410
You can pass anything but I'm going to pass it.

50
00:04:08,430 --> 00:04:16,780
The Post object I'm going to end or close that tack.

51
00:04:16,990 --> 00:04:20,620
So what we're doing here is notice here.

52
00:04:20,620 --> 00:04:23,830
When I used the this embedded would be here.

53
00:04:24,310 --> 00:04:27,900
Of course the sign you only use the Course the sign with it.

54
00:04:27,910 --> 00:04:36,610
If you are expecting an output output in anything has not you see equal to sign but one trying to do

55
00:04:36,610 --> 00:04:42,800
here when I see how post to each I want to loop to each of the post.

56
00:04:42,880 --> 00:04:48,450
That's what this each do is to is going to loop to each of the post.

57
00:04:48,880 --> 00:05:03,760
So let me also come here and create a tack on akwei the Haitian three tag do each 3 and I will bet another.

58
00:05:03,850 --> 00:05:09,140
Amanda Ruby there is sent.

59
00:05:09,270 --> 00:05:13,230
This time I am going to output something and 1.

60
00:05:13,310 --> 00:05:17,990
They tried to put the post title.

61
00:05:20,840 --> 00:05:26,340
K and then a n that.

62
00:05:27,550 --> 00:05:30,760
Then I closed the case 3 tack.

63
00:05:30,760 --> 00:05:40,180
Next I want to set a paragraph and also embed Ruby there in set.

64
00:05:40,190 --> 00:05:54,850
That too possible I want to output the content of the body so I'll do post dot body and are close the.

65
00:05:55,670 --> 00:06:01,420
Then I close the paragraph tack then I have to end the loop.

66
00:06:01,430 --> 00:06:05,930
I need to end the loop just typing end.

67
00:06:08,360 --> 00:06:14,170
Oops too end to look up and we end the look.

68
00:06:14,270 --> 00:06:20,300
It ended in the same way percent at the beginning.

69
00:06:20,530 --> 00:06:29,860
Space for centani and then that to allow have ended up this way the loop starts look posed.

70
00:06:29,890 --> 00:06:35,490
It means it will loop through the post before listing them.

71
00:06:36,310 --> 00:06:38,730
So once you've got all the tags in.

72
00:06:38,730 --> 00:06:42,630
Make sure they are close to us to file save all.

73
00:06:42,880 --> 00:06:51,640
Now if we go back to our site and block the application or everything that you have submitted as a post

74
00:06:51,700 --> 00:06:54,180
should be listed on the home page.

75
00:06:54,370 --> 00:06:55,470
So let me just.

76
00:06:55,570 --> 00:06:55,920
Okay.

77
00:06:55,930 --> 00:07:02,650
Mine's already refroze so you can see this is my blog post which is this one here and these are all

78
00:07:02,650 --> 00:07:05,340
the posts that have submitted.

79
00:07:05,520 --> 00:07:07,270
So this is the test.

80
00:07:07,340 --> 00:07:15,330
Does the title the body title body title body have submitted is total of three.

81
00:07:15,370 --> 00:07:18,330
Post 1 to 3.

82
00:07:18,550 --> 00:07:26,980
So now we are we are able to list on everything we've submitted on the home page which is the main index

83
00:07:26,980 --> 00:07:27,530
page.

84
00:07:27,670 --> 00:07:30,390
So that's it for lists in the post.

85
00:07:30,400 --> 00:07:31,810
Thanks for watching.

86
00:07:31,810 --> 00:07:32,410
Bye for now.
