Slide 1

Slide 1 text

Rails 6 @kyanagimoto

Slide 2

Slide 2 text

ॕ Rails 6 release • Date: Aug 15th 2019 • ৽͍͠ίϯϙʔωϯτ Action Text / Action Mailbox • Webpackerͷ࠾༻ • ෳ਺DB઀ଓɺฒྻςετ࣮ߦ(TDD is dead͔ΒͷྲྀΕ) • > 2.5 https://railsguides.jp/6_0_release_notes.html

Slide 3

Slide 3 text

Action Text • WYSIWYG (΢Οδ΢Οά, What You See Is What You Getͷུͩͬͯ) EditorͷTrixΛ ؆୯ʹ࢖͑ΔΑɻ • ActiveStorageΛEditorͰೖྗͨ͠FileΛอ ଘ͢Δҝʹར༻͍ͯ͠Δɻ
 WYSIWYG Editor಺ʹFileΛૠೖͨ࣌͠͸ ActiveStorageʹDirectUpload͞ΕΔ໛ ༷ɻ

Slide 4

Slide 4 text

Action Mailbox • Mailͷड৴ॲཧͷͨΊͷίϯϙʔωϯτ
 * ActionMailer: MailΛRubyͰ࢖͏ͨΊObjectʹม׵͢ΔͨΊ
 Cloudͷϝʔϧॲཧ΍อଘ͸ࣗલͰ΍Δඞཁ͋ͬͨɻ • ActiveStorageʹMailΛอଘɺAction Mailbox༻ͷDB Tableඞཁ

Slide 5

Slide 5 text

Webpacker • Rails಺ͷJavaScript Library͸npmͰެ։͞Ε͍ͯΔ΋ͷΛར༻ • CoffeeScript…ɻ(Action CableͰGenerate͞ΕΔίʔυ͕มԽ)

Slide 6

Slide 6 text

ෳ਺DB઀ଓ • config/database.yaml
 • app/models/hoge.rb • config/environments
 Sample: 
 https://github.com/ effectiveDevOps/devops_meter/ blob/master/config/environments/ production.rb#L109

Slide 7

Slide 7 text

Parallelize test • github.com/rspec/rspec-rails/issues/2104
 rspecͷରԠ͸Ͳ͏΋·ͩΈ͍ͨͳײ͡ɻ

Slide 8

Slide 8 text

ͱΓ͋͑ͣɺ࡞ͬͯΈ·͠ΐ͏ $ gem i bundler $ gem i rails # YarnΛར༻͢ΔͷͰɺInstallɹhttps://yarnpkg.com/en/docs/install $ brew install yarn $ brew install postgresql $ rails new sample -d postgresql

Slide 9

Slide 9 text

# DockerͰdatabaseཱͯΔ $ brew cask install docker $ docker run --name dev-postgres -e POSTGRES_USER=nikotama -e POSTGRES_PASSWORD=postgres -p 15432:5432 -d postgres:11 # ֬ೝ $ docker container exec -it dev-postgres bash $$ psql -U nikotama $$ \l #database Ұཡ

Slide 10

Slide 10 text

$ vi config/database.yml ## developmentͷusername, password, host, portΛมߋɻ $ rake db:create $ bundle exec rails action_text:install $ bundle exec rails action_mailbox:install $ bundle exec rails db:migrate

Slide 11

Slide 11 text

# Edit Gemfile
 $ vi Gemfile
 ## image_processingͷίϝϯτΞ΢τΛ֎͢ $ bundle install $ bundle exec rails generate scaffold post title:string body:rich_text $ bundle exec rake db:migrate

Slide 12

Slide 12 text

$ bundle exec rails s # Another pane
 $ bin/webpack-dev-server # Access to http://localhost:3000/posts # WYSIWYG Editorग़ݱɻ

Slide 13

Slide 13 text

$ docker container exec -it dev-postgres bash $$ psql -U nikotama $$$ \l
 $$$ \c sample_app_development
 $$$ \d
 $$$ select * from posts;
 $$$ select * from action_text_rich_texts;
 $$$ select * from active_storage_attachments;
 $$$ select * from active_storage_blobs; $ tree ./storage/