-
Notes on the learning process
-
.erb, .scss, .coffee, etc. are file extensions used for processing the files.
- For example, if you have a file called hoo.html.erb.coffee, it will be processed by coffee, then by erb, and the final output will be hoo.html.
-
Controllers are in plural form (UsersController), while models are in singular form (User).
-
In Rails, REST automatically converts to corresponding actions (e.g., GET -> show).
- If you define resources :users in routes.rb, it maps to the RESTful actions for /users.
-
Regarding the database
- Model.update_attribute can bypass validations.
- update_attributes cannot.
- If the parameter is indexed, it can be searched without performing a full scan.
- Model.update_attribute can bypass validations.
-
About testing
- Use assert
to check true/false. - Use assert_XXX
format, such as assert_select or assert_response.
- Use assert
-
Regarding gems
- Clearing the cache can sometimes solve issues.
- The order in which gems are listed in the Gemfile can also affect functionality. For example, Bootstrap may not work if jQuery is not placed before it.