"I'm glad I did the Rails Tutorial, but after two weeks I can't remember what I did."
"What can I do after all?" "I am ... weak ...!"
It is a cheat sheet for such a person.
Save it for the time being, copy and paste it secretly, and add various things to make your own cheat sheet.
[Rails] Search function https://qiita.com/shin1rok/items/779e581e9d12a92310c3 [Rails] Text posting function https://railstutorial.jp/chapters/user_microposts?version=5.1#cha-user_microposts [Rails] I want to post an image (external library --CarrierWave) https://railstutorial.jp/chapters/user_microposts?version=5.1#sec-basic_image_upload [Rails] Posted images get bigger https://railstutorial.jp/chapters/user_microposts?version=5.1#sec-image_validation [Rails] How to save images in production environment → It is better to use cloud storage. https://railstutorial.jp/chapters/user_microposts?version=5.1#sec-image_upload_in_production [Rails] Follow, follower function skeleton https://railstutorial.jp/chapters/following_users?version=5.1#sec-the_relationship_model [Rails] I want to create a follower list page https://railstutorial.jp/chapters/following_users?version=5.1#sec-following_and_followers_pages [Rails] I want to create a follow button (redirect and Ajax) https://railstutorial.jp/chapters/following_users?version=5.1#sec-a_working_follow_button_the_standard_way https://railstutorial.jp/chapters/following_users?version=5.1#sec-a_working_follow_button_with_ajax [Rails] Timeline function https://railstutorial.jp/chapters/following_users?version=5.1#sec-the_status_feed [Rails] Timeline, Feed https://railstutorial.jp/chapters/user_microposts?version=5.1#sec-a_proto_feed [Rails] The one who will be sent an email address after new registration https://railstutorial.jp/chapters/account_activation?version=5.1#cha-account_activation [Rails] The one that can be reset if you forget your password https://railstutorial.jp/chapters/password_reset?version=5.1#cha-password_reset [Rails] Successful! I failed! The one who informs you-flash message https://railstutorial.jp/chapters/sign_up?version=5.1#sec-signup_error_messages https://railstutorial.jp/chapters/basic_login?version=5.1#sec-rendering_with_a_flash_message [Rails] Login and logout functions (on your own) https://railstutorial.jp/chapters/basic_login?version=5.1#cha-basic_login [Rails] Login and logout functions (external library-devise) https://qiita.com/cigalecigales/items/f4274088f20832252374 [Rails] I want to stay logged in even if I log in and close the browser! --Remember me https://railstutorial.jp/chapters/advanced_login?version=5.1#sec-remember_me [Rails] I want to put a thumbnail image --Gravatar https://railstutorial.jp/chapters/sign_up?version=5.1#sec-a_gravatar_image [Rails] I want to display, update, or delete the edit screen https://railstutorial.jp/chapters/advanced_login?version=5.1#sec-remember_me [Rails] I want to undo if the value I enter is not what I expected ――Determine whether it is what you expect → Regular expression, validation https://railstutorial.jp/chapters/modeling_users?version=5.1#sec-user_validations --Undo → Redirect https://railstutorial.jp/chapters/sign_up?version=5.1#sec-unsuccessful_signups
[Rails] ActiveRecord does not guarantee uniqueness at the database level (even if validate guarantees uniqueness) → It can be solved by adding index https://railstutorial.jp/chapters/modeling_users?version=5.1#sec-uniqueness_validation [Rails] I want to verify what I save before saving it to the database-validation https://railstutorial.jp/chapters/modeling_users?version=5.1#sec-user_validations
[Rails] Pagination (pagination) https://railstutorial.jp/chapters/updating_and_deleting_users?version=5.1#sec-pagination [Rails] edit form https://railstutorial.jp/chapters/updating_and_deleting_users?version=5.1#sec-edit_form [Rails] I want to display a list https://railstutorial.jp/chapters/updating_and_deleting_users?version=5.1#sec-showing_all_users [Rails] I want to call a partial template → render ‘file name’ https://pikawaka.com/rails/render
[Rails] Implementation when form input fails https://railstutorial.jp/chapters/updating_and_deleting_users?version=5.1#sec-unsuccessful_edits [Rails] Use of path and url properly in Rails redirect_to (similar) https://teratail.com/questions/204077 [Rails] I want to call a partial template → render ‘file name’ https://pikawaka.com/rails/render [Rails] Destroy Actions and Security https://railstutorial.jp/chapters/updating_and_deleting_users?version=5.1#sec-the_destroy_action [Rails] Difference between new and build Both the new and build methods instantiate, build can automatically set the user_id and create an instance. https://qiita.com/Kaisyou/items/8876f39e12631f4e5154 [Rails]CRUD(Create) https://railstutorial.jp/chapters/sign_up?version=5.1#sec-signup_form [Rails]CRUD(Read) https://railstutorial.jp/chapters/updating_and_deleting_users?version=5.1#sec-showing_all_users [Rails]CRUD(Destroy) https://railstutorial.jp/chapters/updating_and_deleting_users?version=5.1#sec-the_destroy_action
[Rails] I want to display the top page in the state of localhost3000 / (3) → root https://railstutorial.jp/chapters/static_pages?version=5.1#sec-setting_the_root_route
[Rails] RESTful routing https://railstutorial.jp/chapters/sign_up?version=5.1#table-RESTful_users https://qiita.com/NagaokaKenichi/items/0647c30ef596cedf4bf2
[Rails] I want to add new actions other than RESTful to RESTful routing using resources. https://qiita.com/ebihara99999/items/37afb1486442e7c16a8a https://railstutorial.jp/chapters/following_users?version=5.1#sec-stats_and_a_follow_form
[Rails] I want to change the column name https://qiita.com/libertyu/items/93acd8733e34b1d0a63c
[Rails] Create seed (I want to create many sample users in DB) https://qiita.com/takehanKosuke/items/79a66751fe95010ea5ee https://railstutorial.jp/chapters/updating_and_deleting_users?version=5.1#sec-sample_users
[Rails] Delete migration file https://qiita.com/tanaka-t/items/cd6aa0526725e88f5024
[Rails] I want to improve the readability of SQL in ActiveRecord → Scope https://qiita.com/ngron/items/14a39ce62c9d30bf3ac3
[Rails] I want to search across multiple tables https://qiita.com/leon-joel/items/f26556c9e56833983856 https://qiita.com/makitokezuka/items/f13b2e7bad77b5594911
[Rails] index By creating an index, only the necessary data is saved separately from the table in a state optimized for searching separately from the table. In addition to sorting for search, only indexed columns can be searched, so high-speed search is possible. The disadvantage is that it takes time to add data because the table for searching is saved separately from the table. Because when you add data you have to add two tables. https://railstutorial.jp/chapters/user_microposts?version=5.1#sec-a_micropost_model https://www.dbonline.jp/sqlite/index/index1.html https://ja.wikipedia.org/wiki/%E7%B4%A2%E5%BC%95_%28%E3%83%87%E3%83%BC%E3%82%BF%E3%83%99%E3%83%BC%E3%82%B9%29
[Rails] I want to be able to delete a child when I delete a parent dependent:: destroy https://railstutorial.jp/chapters/user_microposts?version=5.1#sec-dependent_destroy
[Rails] How to call data in another table at the time of relation https://railstutorial.jp/chapters/user_microposts?version=5.1#sec-destroying_microposts
[Rails] Preventing a user from following the same user more than once-composite key index https://railstutorial.jp/chapters/following_users?version=5.1#sec-a_problem_with_the_data_model
[Rails] Strong parameters https://railstutorial.jp/chapters/updating_and_deleting_users?version=5.1#sec-revisiting_strong_parameters [Rails] Mass Assignment → Save the request data as it is in the database (weak in security) https://thinkit.co.jp/story/2015/09/03/6389
[Rails] I want to get my work back! rails destroy controller ~ https://railstutorial.jp/chapters/static_pages?version=5.1#sec-generated_static_pages
[Rails] Account activation https://railstutorial.jp/chapters/account_activation?version=5.1#cha-account_activation
[Rails]SSL Technology that encrypts important information before it flows from a local server to the network https://railstutorial.jp/chapters/sign_up?version=5.1#sec-ssl_in_production
[Rails] CSRF measures [Controller] protect_from_forgery with: :exception https://qiita.com/tanaka7014/items/5b4e2204dc6bec83c90e
[Rails] Placeholder https://wa3.i-3-i.info/word118.html
[Rails] I want to hash and encrypt passwords and save them https://railstutorial.jp/chapters/modeling_users?version=5.1#sec-adding_a_secure_password
[Rails] I want to display an error message on the browser screen https://railstutorial.jp/chapters/basic_login?version=5.1#sec-rendering_with_a_flash_message https://railstutorial.jp/chapters/sign_up?version=5.1#sec-signup_error_messages https://railstutorial.jp/chapters/sign_up?version=5.1#sec-the_flash
[Rails] I want to make the email address lowercase before saving it to the database-callback https://qiita.com/okamoto_ryo/items/458097542e826623b7ad https://railstutorial.jp/chapters/account_activation?version=5.1#sec-activation_token_callback Callback. It refers to a mechanism that adds common processing before and after when an object is created (created), updated (updated), destroyed (deleted), or when validation is executed. before_save { self.email = email.downcase } Pass the block and set the user's email address before_create :create_activation_digest The code above is called a method reference, which causes Rails to look for a method called create_activation_digest and execute it before creating the user.
[Rails] I want to display the page only to logged-in users Controller before_action :logged_in_user, only: [:edit, :update] https://railstutorial.jp/chapters/updating_and_deleting_users?version=5.1#sec-authorization
[Rails] I want to edit only myself https://railstutorial.jp/chapters/updating_and_deleting_users?version=5.1#sec-requiring_the_right_user
[Rails] Ability to redirect to the page you were viewing just before logging in after the user logged in → I want to access the URL of the page dedicated to login users → Log in → I can go to the page dedicated to login that I saw earlier Friendly forwarding request.url https://railstutorial.jp/chapters/updating_and_deleting_users?version=5.1#sec-friendly_forwarding [Rails] I want to return the previous URL (I want to redirect) request.referrer https://railstutorial.jp/chapters/user_microposts?version=5.1#sec-destroying_microposts [Rails] Difference between authorization and authentication https://qiita.com/kaysquare1231/items/c4e4736f2a924b03777b
[Rails] I want to combine similar code into one (partial) https://railstutorial.jp/chapters/filling_in_the_layout?version=5.1#sec-partials
[Rails] If you want to write DRY code, but some parts are different https://railstutorial.jp/chapters/updating_and_deleting_users?version=5.1#sec-edit_form
[Rails] DRY variable elements in the title https://railstutorial.jp/chapters/static_pages?version=5.1#sec-layouts_and_embedded_ruby https://qiita.com/shumpeism/items/a0ad5930fa3bc0d24c70
[Rails] I defined a private method in controller, but I want to use the method defined in a different Controller because it is very versatile (inheritance → application_controller.rb) https://railstutorial.jp/chapters/user_microposts?version=5.1#sec-micropost_access_control
[Rails] Notation list https://qiita.com/gakkie/items/3afcd505c786364aa5fa https://blog.mothule.com/ruby/ruby-percent-syntax
[Ruby] Notation list https://railstutorial.jp/chapters/rails_flavored_ruby?version=5.1#cha-rails_flavored_ruby
[Rails] Difference between keyword argument and optional argument https://railstutorial.jp/chapters/updating_and_deleting_users?version=5.1#sec-users_index
Recommended Posts