Hello and welcome.
In this lecture we are going to declare or create a resul what is a resource in Ruby on Rails a resource.
He is referred to his collection of simular objects are glimmers could include post articles people
animals can't eat fruits and so on.
You can also create a crowd operation for Resource krudd basically stands for create.
Read.
Destroy destroy and delete the same thing so you can create a cross operation for a resource.
So our web server is still running and that's how our page had the mom in the home page.
We are going to need to create a few actions and also views for our post controller.
So instead of doing the roots of the rats manually We are going to declare the post as a resource and
the roads will be automatically generated from so when you create some power as a resource it generates
defrantz for that resource.
So let's open up our text editor.
Expand the folder and then go to the trouts.
So it would be on that config and then erupts.
So inside is routs.
Here we are going to clear the post as a resource.
So just tab down and just all you need to do just type in the word resource.
Okay resources.
Yeah and then space.
Call on and typing posts and that has now declared the post as a resource.
So let's save the sit far click save or so now we've got the post as a response.
By doing it this way that means we don't need to manually cruet the individual rollout's.
So what I'm going to do now we are going to write and I'm going to write a command that would display
all the rules by including the post as a resource here inside the Ralph's far to generate the routs
the friend runs for the post.
So let's see how that is done.
So open up your terminal and leave the server running.
Open up another terminal.
Make sure you have navigated to your proved appropriate directory or your application directory.
As I am you can see mine here.
So what's in your project or application Derek create the command you need to type.
Be n for if you on Windows machine slash don't type in the word Real's space reals will address space
routs.
If present up what this would do it was show or did define results.
Press Enter.
You see all the results generated so as you can see it has generated all the rules.
This prevents us from doing it manually by declaring the post as a resource heater's generated for this
rantz for us so you can see the index.
You've got to create new eddied show or date and distrait which is also delete.
So these are all the different control action for example for the post control.
Kim performing create.
When you create a new post then here of quote new again when you get the puts.
So you've got the edit view on an edit to post and to show the PO's update and it is sure you can see
there a different method here.
He can see you've got to put the lead patch get all these different methods that are used for their
outs so that's it for this lecture.
In this make sure we declare the post as a resource an also ran the reals rollout's command to see or
the defined rantz that we create it by declaring the post as a resource.
Thanks for watching and bye for now.