For your application, Rails controller is the logical center. It combines. communication between model,user, and Views.For ancillary services controller is home. Identically it explains the The History of Ruby On Rails Controller.
And the controller is right over Internal actions and external Requests.And it is having. An option to take care about user friendly URLs. It can manage classes, so that it gives the users a good Impression. Of an communication with Applications.
The making of a controller is simple and familiar to the Process. similarly which we have Implemented for a making a model. we will start one simple controller here.
library\> rails generate controller Book
make sure that you are using one form. And this is Ruby on Rails Online Training process which you should follow every time while you are creating a Controller.
The Below command operates so many tasks. which are related here.
It starts a file called app/controllers/book_controller.rb. This will uniquely Explains the The History of Ruby On Rails Controller
if you see at book_contorller.rb , you will find the below
Class Book-controller < applicationcontroller
Controller classes receive from Application controller, and that will be the another file. Controller folder : Application.rb
The App Controller has can be performed in all your controllers and it will be received from. Rails Action controller : Basic Session.
No we will Implement each and every method one by one
The method list will provide you a book list in the Data Base. you can get this functionality by getting by the below lines of code. you can edit the following lines in book_controller.rb file.
@books = book.all
@book = Book.all, This line in list method will tell rails to get search the table books and so that each row is stored in @book. Instance object.
Next one is we a have to Implement the show method
show Method will shows on the Display only few other details on single book. This method will be received by very few line of scripting. Correspondingly this will explain The History of Ruby On Rails Controller
@book = Book.find(param[:id]}
The show functionality @book = Book.find(param[:id]) line will guide rails to search only the book. That which has ID Defined in param [:id]
The param is a container object, that starts. you to pass values in calls method. For Instance, when you are on the page, it is called by a list method. you have an option to click on a link for particular book. It releases the ID of that Book. By the param object. so that show can see a specific book.
Making in to Process with a New Method :
In new method the Rails will start a new Object. so just add the below code in this method.
The updated method lets rails to know that , you can start a new object . so by simply adding the below code in this method. In the First place this will explain The History of Ruby On Rails Controller
@book = Book.new
@subjects = subject.all
The above method will be considered. when yo show the page to the user to take his Input. second line shows subjects from Data base and keeps in an array of @subjects .
Processing the Create Method :
when you take user Input Format with HTML form. It is the starting point to create . A progress in to the Data base. To get this ,you have to start a method in book_controller to equal the following data at Ruby on Rails online course.
It’s good to have knowledge of basic Concepts of PHP And HTML but it is not mandatory. Trainers of Online IT Guru will teach each and everything you if you don’t have knowledge of those Concepts.