1 00:00:00,700 --> 00:00:07,580 Hello and welcome in this show we are going to implement edit in our post. 2 00:00:07,930 --> 00:00:13,440 So this is what our blog looks like other more menso finally Congo took post. 3 00:00:13,540 --> 00:00:22,030 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 4 00:00:22,060 --> 00:00:23,760 puss or we will click on edit. 5 00:00:23,830 --> 00:00:34,880 It will present the form that will enable us to edit the post so we have to go to issue view templates. 6 00:00:35,080 --> 00:00:39,470 Click on that and click on this show. 7 00:00:39,780 --> 00:00:42,170 S t e mail dot E R B. 8 00:00:42,170 --> 00:00:46,080 So this is where will going to be to in some implementation. 9 00:00:46,120 --> 00:00:47,380 So I want to add. 10 00:00:47,530 --> 00:00:48,810 And hey higher tack. 11 00:00:48,820 --> 00:00:57,760 Just to put an on the line someone tab down and just tag each are nothing. 12 00:00:57,770 --> 00:01:05,860 Tag the issue here miltown you need to add a chart here on line horizontal line to the page. 13 00:01:06,250 --> 00:01:15,790 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 14 00:01:15,790 --> 00:01:16,850 post. 15 00:01:17,110 --> 00:01:20,560 So you two percent. 16 00:01:21,000 --> 00:01:29,910 An equal to the link help up which is the link underscore to. 17 00:01:30,060 --> 00:01:37,750 I am going to link this to in quotes with an A C edit. 18 00:01:38,140 --> 00:01:40,720 We need to also specify a path. 19 00:01:40,750 --> 00:01:42,640 Follow a link to go to. 20 00:01:42,670 --> 00:01:46,530 So would a comma and then we'll see edit. 21 00:01:47,820 --> 00:01:50,650 On the score post. 22 00:01:51,920 --> 00:01:52,890 On the score. 23 00:01:52,900 --> 00:01:57,440 Part of an impact this is going to pass him. 24 00:01:57,480 --> 00:02:00,310 The art pulls to a variable. 25 00:02:01,630 --> 00:02:04,960 Next one at a bootstrap class. 26 00:02:05,000 --> 00:02:10,230 So we do a karma up call on class. 27 00:02:12,310 --> 00:02:13,150 And the class. 28 00:02:13,150 --> 00:02:14,740 I'm going to add. 29 00:02:14,770 --> 00:02:17,380 Can call it's going to be a button class. 30 00:02:17,650 --> 00:02:27,130 So do beat in Das T Pain high phone defaults. 31 00:02:27,270 --> 00:02:29,880 This would create a default button. 32 00:02:31,980 --> 00:02:37,200 Then dash would close a tag. 33 00:02:37,540 --> 00:02:47,310 Okay so let's save this and have a look at the button and go back to the pause refresh. 34 00:02:47,950 --> 00:02:54,340 Okay right now if you click on it is going to air is not going to work because we need to add the action 35 00:02:54,340 --> 00:02:55,290 for this. 36 00:02:55,410 --> 00:02:58,210 Inside are post controller. 37 00:03:00,040 --> 00:03:01,420 So we are here. 38 00:03:01,420 --> 00:03:09,320 This is a post control answer under just going to add where you are defining your action for your controller. 39 00:03:09,570 --> 00:03:12,730 They must all be public so you can do anything private. 40 00:03:12,730 --> 00:03:15,780 If not there will not be neukom be assessable. 41 00:03:16,120 --> 00:03:20,550 So just on darna here after they create. 42 00:03:20,560 --> 00:03:27,250 I'm just going to come down here and define the actions. 43 00:03:27,690 --> 00:03:32,320 Not going to the final edit action and end. 44 00:03:32,690 --> 00:03:34,010 That's okay. 45 00:03:34,420 --> 00:03:36,530 And as a variable i. 46 00:03:36,550 --> 00:03:37,520 Where you edit. 47 00:03:37,540 --> 00:03:41,320 You want to be able to edit a particular post. 48 00:03:41,340 --> 00:03:43,540 I'm gonna reference that using the air. 49 00:03:43,600 --> 00:03:49,770 I did links a worm cannot do and will copy this here from this show. 50 00:03:50,080 --> 00:03:51,760 Right click. 51 00:03:51,760 --> 00:03:54,880 Copy and here. 52 00:03:55,060 --> 00:04:00,750 Paste it because we are interested in edit in vi the idea. 53 00:04:00,760 --> 00:04:04,340 So every submission will have an idea reference. 54 00:04:04,630 --> 00:04:07,590 So make sure you see that. 55 00:04:08,320 --> 00:04:12,600 Now that we've created the action we have to create a corresponding view. 56 00:04:12,610 --> 00:04:16,170 So each time you create an account you need to have a corresponding view. 57 00:04:16,270 --> 00:04:18,880 So let's go to our views here. 58 00:04:18,880 --> 00:04:26,830 This is the view used sabb expand that and post here we've got index We've got new show going to right 59 00:04:26,890 --> 00:04:40,240 click and create one for edit so all we do file would save as I would call it edit Doc hastier mail 60 00:04:40,660 --> 00:04:42,700 Dort E R B. 61 00:04:42,730 --> 00:04:46,250 B stands for X embedded Ruby. 62 00:04:46,870 --> 00:04:55,060 Okay now we've got the p for our edit so we want the template also have a form saw when the edited button 63 00:04:55,060 --> 00:04:55,530 is clicked. 64 00:04:55,540 --> 00:04:56,980 It should present a form. 65 00:04:57,160 --> 00:04:58,060 So what I'm going to do. 66 00:04:58,070 --> 00:05:00,860 I'm going to click on the new. 67 00:05:01,150 --> 00:05:04,810 So basically he's going to be an identical form with just a few edits. 68 00:05:04,810 --> 00:05:15,160 I'll copy everything from the new template and paste that into the edit and will just make a few edits 69 00:05:15,160 --> 00:05:16,470 in here. 70 00:05:16,570 --> 00:05:21,550 First you need to do is change the title from ad post to edit post. 71 00:05:23,950 --> 00:05:27,070 Okay you are real. 72 00:05:27,090 --> 00:05:33,960 He's going to be different for the edits or I'm going to change is to single the post PAFF. 73 00:05:35,310 --> 00:05:47,800 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 74 00:05:47,800 --> 00:05:52,660 to have the meffert book comma and space 75 00:05:55,290 --> 00:05:59,200 type pain methot. 76 00:05:59,260 --> 00:06:03,860 You'd do a call on there and instead of a post. 77 00:06:03,860 --> 00:06:07,860 He's the method is going to be a patch. 78 00:06:08,920 --> 00:06:18,660 Okay so let's save this and go back to the form refresh. 79 00:06:20,640 --> 00:06:24,630 Now she'd click on edit it should give us a form xolo. 80 00:06:24,720 --> 00:06:30,600 Well it wouldn't work if we tried to savour the moment because we need to add an obsolete action that 81 00:06:30,600 --> 00:06:41,040 will update the changes we'll make so we need to go back to the controller and had an OB Dete action. 82 00:06:41,040 --> 00:06:53,630 So just underneath the edit action we are going to define odd date action of date and just tab that 83 00:06:53,700 --> 00:06:57,770 down a bit just like we did with the edit. 84 00:06:57,800 --> 00:07:01,490 I'm just going to call pubis were near Earth here. 85 00:07:03,080 --> 00:07:06,920 And Tab down and paste that in there. 86 00:07:06,970 --> 00:07:17,110 We need the I.D. So we know what pulls were edited in and then we go to the IT action and copy this 87 00:07:17,110 --> 00:07:17,960 bit here. 88 00:07:17,980 --> 00:07:23,380 If this meant copy that and come down here. 89 00:07:24,430 --> 00:07:27,350 And just drop that on the net there. 90 00:07:29,230 --> 00:07:29,950 K. 91 00:07:31,540 --> 00:07:39,590 Just need to make a few changes so is not going to be post seyfarth going to be post op date. 92 00:07:39,720 --> 00:07:44,080 Of course we are obsolete and the Post and their worgan india will gain a wrap. 93 00:07:44,110 --> 00:07:52,780 They post parramore in between this post update will put an urn parentheses and war wrap the post on 94 00:07:52,790 --> 00:07:54,430 the core programs in there. 95 00:07:54,430 --> 00:08:00,930 Click on that saw Read director post even that condition is false there. 96 00:08:00,980 --> 00:08:11,330 We won a render B edit form with honour and the new one or under Edit souls save the changes and let's 97 00:08:11,350 --> 00:08:15,400 try again just refresh that. 98 00:08:16,080 --> 00:08:18,330 So let's go to the home page. 99 00:08:18,370 --> 00:08:18,760 All right. 100 00:08:18,760 --> 00:08:19,150 Good. 101 00:08:19,160 --> 00:08:26,700 To do it's post some gallogly edit are changed side to see. 102 00:08:29,680 --> 00:08:31,250 Change one. 103 00:08:33,550 --> 00:08:42,520 Body Text one and click save and go back to the home page. 104 00:08:42,880 --> 00:08:45,560 Excellent so the change as been effective. 105 00:08:45,640 --> 00:08:47,360 This is change with just me. 106 00:08:47,380 --> 00:08:55,750 Excellent so we've successfully implemented the edit functionality so we're now able to edit our post 107 00:08:56,180 --> 00:09:00,700 so thanks for watching and take care and bye for now. 108 00:09:01,030 --> 00:09:08,410 In our next lecture we are going to implement this action there where neighbour close to delete the 109 00:09:08,410 --> 00:09:09,460 post. 110 00:09:09,460 --> 00:09:10,500 Thanks for watching.