I'm studying a drill at a certain programming school because I didn't understand it, but I'll give you "problems", but since "interpretation and background of answers" is a stance that you should look up yourself, I will summarize it in a public article. To go.
By the way, like the previous article, I am reviewing school problems in a limited article. By the way, when solving the following, the answer I gave is not always the optimal solution, but I hope you can find it for reference only.
* * * * * * * * * * * * A -Objects are created or deleted by rails actions. This process is called the object life cycle. Callbacks are the processes that occur before and after the object changes in this cycle. -Roughly chewing is the process performed when extracting from the database and registering. If it's something familiar, it's like validation. If you want to do something before registering in the database, write before_create or the same method in the model.
* * * * * * * * * * * *
*
A It looks like a string, but it's treated as a number in the process. Since the numerical value corresponding to the symbol is 1 to 1, even if you define a lot, it will not overwhelm the memory
* * * * * * * * * * A -The object itself that passes through the model -Since the instance is not defined in the model, even if @post is defined by the controller, it will not be recognized. So self is an alternative. If you do p self.name, Taro will be output. There is no need to bother to define self.
* * * * * * * * * * * * A Unauthorized use of cookies to perform unauthorized operations (post deletion) with another person's account. (Crushing) Countermeasure-protect_from_forgery with :: exception As a result, each post from the form is verified by issuing a token to see if it has been used illegally.
* * * * * * * * * * * A Returns the number of elements in the receiver. If no argument is given, the number of elements in the receiver is returned. If one argument is specified, the number of receiver elements that match the argument is counted. If you specify a block, evaluate the block and count the number of elements that have become true.