Hello and welcome in this show we are going to implement edit in our post.
So this is what our blog looks like other more menso finally Congo took post.
There's no botin here's a war one to do is be able to add a botin here that will enable us edit the
puss or we will click on edit.
It will present the form that will enable us to edit the post so we have to go to issue view templates.
Click on that and click on this show.
S t e mail dot E R B.
So this is where will going to be to in some implementation.
So I want to add.
And hey higher tack.
Just to put an on the line someone tab down and just tag each are nothing.
Tag the issue here miltown you need to add a chart here on line horizontal line to the page.
So now I'm going to add a link using a link helper so this will link to a nibble or to edit the individual
post.
So you two percent.
An equal to the link help up which is the link underscore to.
I am going to link this to in quotes with an A C edit.
We need to also specify a path.
Follow a link to go to.
So would a comma and then we'll see edit.
On the score post.
On the score.
Part of an impact this is going to pass him.
The art pulls to a variable.
Next one at a bootstrap class.
So we do a karma up call on class.
And the class.
I'm going to add.
Can call it's going to be a button class.
So do beat in Das T Pain high phone defaults.
This would create a default button.
Then dash would close a tag.
Okay so let's save this and have a look at the button and go back to the pause refresh.
Okay right now if you click on it is going to air is not going to work because we need to add the action
for this.
Inside are post controller.
So we are here.
This is a post control answer under just going to add where you are defining your action for your controller.
They must all be public so you can do anything private.
If not there will not be neukom be assessable.
So just on darna here after they create.
I'm just going to come down here and define the actions.
Not going to the final edit action and end.
That's okay.
And as a variable i.
Where you edit.
You want to be able to edit a particular post.
I'm gonna reference that using the air.
I did links a worm cannot do and will copy this here from this show.
Right click.
Copy and here.
Paste it because we are interested in edit in vi the idea.
So every submission will have an idea reference.
So make sure you see that.
Now that we've created the action we have to create a corresponding view.
So each time you create an account you need to have a corresponding view.
So let's go to our views here.
This is the view used sabb expand that and post here we've got index We've got new show going to right
click and create one for edit so all we do file would save as I would call it edit Doc hastier mail
Dort E R B.
B stands for X embedded Ruby.
Okay now we've got the p for our edit so we want the template also have a form saw when the edited button
is clicked.
It should present a form.
So what I'm going to do.
I'm going to click on the new.
So basically he's going to be an identical form with just a few edits.
I'll copy everything from the new template and paste that into the edit and will just make a few edits
in here.
First you need to do is change the title from ad post to edit post.
Okay you are real.
He's going to be different for the edits or I'm going to change is to single the post PAFF.
And I'm going to wrap in that pain and this is going to pass him the post veera ball and then I'm going
to have the meffert book comma and space
type pain methot.
You'd do a call on there and instead of a post.
He's the method is going to be a patch.
Okay so let's save this and go back to the form refresh.
Now she'd click on edit it should give us a form xolo.
Well it wouldn't work if we tried to savour the moment because we need to add an obsolete action that
will update the changes we'll make so we need to go back to the controller and had an OB Dete action.
So just underneath the edit action we are going to define odd date action of date and just tab that
down a bit just like we did with the edit.
I'm just going to call pubis were near Earth here.
And Tab down and paste that in there.
We need the I.D. So we know what pulls were edited in and then we go to the IT action and copy this
bit here.
If this meant copy that and come down here.
And just drop that on the net there.
K.
Just need to make a few changes so is not going to be post seyfarth going to be post op date.
Of course we are obsolete and the Post and their worgan india will gain a wrap.
They post parramore in between this post update will put an urn parentheses and war wrap the post on
the core programs in there.
Click on that saw Read director post even that condition is false there.
We won a render B edit form with honour and the new one or under Edit souls save the changes and let's
try again just refresh that.
So let's go to the home page.
All right.
Good.
To do it's post some gallogly edit are changed side to see.
Change one.
Body Text one and click save and go back to the home page.
Excellent so the change as been effective.
This is change with just me.
Excellent so we've successfully implemented the edit functionality so we're now able to edit our post
so thanks for watching and take care and bye for now.
In our next lecture we are going to implement this action there where neighbour close to delete the
post.
Thanks for watching.