Rails - How does the show and new action work -


The very common question I was hoping that someone could explain to me is the basic name for a model in the name of the products I am seeing the generated sloppy code. I noticed that there is not much in the controller new and much of the work in the show. In fact, the show is completely empty and only the new line is " @product = Product.new ". I know that these 2 actions should go on a different scene. A new form view in order to show a resource, and input information and a resource form, respectively.

So, I'm curious how this really happens. Other actions: redirect_to: some_path that makes sense, but actually shows " action, location: @ productive " bring page to show item when action is empty? Apart from how is it different from redirect_to @product ?

render generates a string application Will be displayed as a response to the request.

redirect_to generates a feedback header, resulting in a new request for the application.

Render action 'show' location: @ productive file to app / view / product / show.html. ARB will produce html as a parameter to use @product with .

The reason for some of the control work being done is that the railways are using the default, so if you tell the rail what to render, then the rail will see a file in the appropriate place.

The methods that end with redirect_to usually save some requests for post / patches after your database and requested action, they can display the information to the user Redirect to one method.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -