Hello and welcome.
In this lecture we are going to list all of our post at the moment we can post or we don't have them
listed.
We want a way for the post to be listed on the home page.
So currently this is what we have.
So when you send the post this is what it displays that the hit.
This one here is the title which is the H2.
And this is the body variable.
The is the text that was sent So we want a way of listing the or the post that has been submitted.
Let's have a quick look at the results so that we know which rout we are looking here to use.
So.
So this is the routs here and this is what we want here.
So we want the Post index we want the Post controller and the index action.
So this is his post.
Get it.
Get all the posts and list them inside this action index action and the post controller.
So let's go to the controller and amend the index for you.
So I'm going to go.
This is a controller here.
This is a post on the score controller.
So I just need to tab down and add a variable to that.
So all I need to do is to at once.
Kim said that to each course to post dot or.
So the line I've added here is the fact that a variable this pulse variable and the said that two equals
to the post model this upper case P is a plus model so as to get all the pause there is submit it is
in the post model here.
This would get it from the database everything I guess sent submitted this post model here.
Get the more from the database.
That's what that means.
So let me say that now we need to go to our index at the moment.
If I opened up the site you find just refer to the index.
This is what the index looks like at the moment so we want all the post to be listed here in the index
few so we need to make some changes to look in to the index template.
So good to the templates we use on them for use on the polls.
We've caught indexed top tier mount so we just need to edit this index story.
Sh t e mail and e r b.
Just need to amend this template.
Alright so I know it is template so I just going change the text from hellowallet and change it to my
blog post.
Okay put the nest there.
I missed out the closing time.
Okay.
In the next line I want to do is add an embedded Ruby to that.
Bet do a percent sign and Space at.
Send that to the post variable dot.
Explain what it means in a minute space do.
And then in between and when liquid pipes the pipe symbology toast next to Dizzy character switching
between the pipe and will pass.
You can pass anything but I'm going to pass it.
The Post object I'm going to end or close that tack.
So what we're doing here is notice here.
When I used the this embedded would be here.
Of course the sign you only use the Course the sign with it.
If you are expecting an output output in anything has not you see equal to sign but one trying to do
here when I see how post to each I want to loop to each of the post.
That's what this each do is to is going to loop to each of the post.
So let me also come here and create a tack on akwei the Haitian three tag do each 3 and I will bet another.
Amanda Ruby there is sent.
This time I am going to output something and 1.
They tried to put the post title.
K and then a n that.
Then I closed the case 3 tack.
Next I want to set a paragraph and also embed Ruby there in set.
That too possible I want to output the content of the body so I'll do post dot body and are close the.
Then I close the paragraph tack then I have to end the loop.
I need to end the loop just typing end.
Oops too end to look up and we end the look.
It ended in the same way percent at the beginning.
Space for centani and then that to allow have ended up this way the loop starts look posed.
It means it will loop through the post before listing them.
So once you've got all the tags in.
Make sure they are close to us to file save all.
Now if we go back to our site and block the application or everything that you have submitted as a post
should be listed on the home page.
So let me just.
Okay.
Mine's already refroze so you can see this is my blog post which is this one here and these are all
the posts that have submitted.
So this is the test.
Does the title the body title body title body have submitted is total of three.
Post 1 to 3.
So now we are we are able to list on everything we've submitted on the home page which is the main index
page.
So that's it for lists in the post.
Thanks for watching.
Bye for now.