[RUBY] Rails Development Transition 2020

Overview

--I've been using Rails to create websites. ――This year, I learned HTML and CSS and started to make UI. ――Since learning vue/nuxt, the way of development has changed

Webpack --Rails original view creation is in erb format. It seems normal to write in slim --Since Rails 5.2, Webpack is supported, and you can create HTML using vue. I don't know. --Only the description that refers to javascript is in views. Create the actual contents in the javascript directory

manner

--Qiita has an easy-to-understand tutorial, so it's a good idea to refer to it. --On the vue side, development will be faster if you use the vue CLI. After completing it to some extent with vue CLI, I created it by copying and pasting it to rails javascript.

Disadvantage

--If you develop without setting anything, you need to restart rails s after updating vue. --When using vue-router, I get a routing error when hot reloading.

Developed separately on the server side and front side

--rails is specialized only on the server side, and the front is created with vue. --It is now possible to design the server and front separately. (Aware of API) --Easy to find errors and improved development efficiency --DB migrated to firebase (previously used postgreSQL)

Gem that learned how to use this year

Rails active admin --You can create an administrator screen --In Rails, when you create data, you can create it with the console or seed, but you can edit it on the screen using active admin. --The UI is created in a format that is not an html template. Therefore, even if you want to put a map on the administrator screen, it is actually impossible. --I haven't used firebase storage since I started using it.

devise --The de facto standard for creating login functions with Rails --It implements session and password encryption nicely (too convenient to forget session and so on) ――Since I started to develop the back and front separately, I can no longer use helper methods. --I started using firebase auth and it is no longer needed.

active record --Gem used when uploading images with Rails --If you create a view with erb, you can fully benefit from it. (You can also get the image from the URL with just the controller) ――I think it would be convenient to use active record in its original way, but it's difficult to do anything other than its original way (it's hard to understand where and what is working). --When uploading image files, carrierwave makes it easier to understand where and what is being processed.

miniMagic --Gem for processing and editing images with Rails --Since there are not many references, I only know the minimum usage. --Processing takes time. I tried to use it with LINE Messanger, but the processing speed was slow and I couldn't use it properly. --Since image editing is done with javascript and the design is such that the image file is saved in firestorage, it is no longer necessary to create an image on the server side and send it to the front side.

About the future

--If you develop in API mode with Rails, you don't need to be Rails ... --Under consideration of express in node.js or fast API in python ――However, ruby ​​is my favorite language, so if there is a merit to use ruby ​​and rails, I would like to use it. ――Please tell me if there is a way to use rails. d

Recommended Posts

Rails Development Transition 2020
[Rails] Development with MySQL
Android development ~ Screen transition (intent) ~
[Rails] How to prevent screen transition
[Rails 6] API development using GraphQL (Query)
[Rails g.error]
Rails basics
Rails Review 1
Rails API
Rails migration
[Rails] first_or_initialize
rails tutorial
About Rails 6
Rails foundation
Rails memorandum
rails tutorial
rails tutorial
[Docker] Development environment construction Rails6 / Ruby2.7 / MySQL8
[Rails] devise
rails tutorial
rails tutorial
Rails Tips
rails method
rails tutorial
[Rails] ActiveRecord
[Rails] form_with
Rails Review 2
Build a development environment for Docker + Rails6 + Postgresql
This and that of conditional branching of rails development
Rails6.0 ~ How to create an eco-friendly development environment
Rails development environment created with VSCode and devcontainer
Ruby on Rails development environment construction on M1 Mac