Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Why Rails 5.1
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Kyuden Masahiro
June 28, 2017
Programming
780
1
Share
Why Rails 5.1
MedBeer -Rails 5.1での開発について
https://medpeer.connpass.com/event/58805/
Kyuden Masahiro
June 28, 2017
More Decks by Kyuden Masahiro
See All by Kyuden Masahiro
Red-Black Tree for Ruby
kyuden
1
2.1k
365日24時間稼働必須サービスの 完全無停止DB移行
kyuden
23
11k
Rails Authorization
kyuden
21
15k
One Night Vue.js
kyuden
14
3.8k
Other Decks in Programming
See All in Programming
新規プロダクトを高速で生み出すハーネスエンジニアリング
seanchas116
17
7.5k
技術記事、AIに書かせるか、自分で書くか? 〜それでも私が自分の手で書く理由〜 / #QiitaConference
jnchito
2
1.2k
1人1案件のプロダクトエンジニア時代に、"プロセス監督"としてチャレンジしたこと
non0113
0
350
タクシーアプリ『GO』の バックエンド開発のおける AI利活用と若者のすべて
pyama86
3
1.8k
誰も頼んでない機能を出荷した話
zekutax
0
150
TypeSpec で繋ぐ複数プロダクトの型安全
maroon8021
1
270
権限チェックの一貫性を型で守る TypeScript による多層防御
mnch
4
980
inferと仲良くなる10分間
ryokatsuse
1
280
[KCD Czech] eBPF Meets the GPU: Future of AI Infra Observability
doniacld
0
130
Old Dog, New Tricks: The Java 25 Reinvention - JNation
bazlur_rahman
0
140
Oxlintはいかにしてtsgolintのlint ruleを呼び出しているのか
syumai
2
1k
サーバーレスで作る、動画データ管理基盤
oyasumipants
0
320
Featured
See All Featured
Designing Powerful Visuals for Engaging Learning
tmiket
1
390
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.5k
Mobile First: as difficult as doing things right
swwweet
225
10k
Navigating Weather and Climate Data
rabernat
0
200
Typedesign – Prime Four
hannesfritz
42
3.1k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.3k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
240
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.3k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
300
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
150
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.8k
Transcript
Why? Rails 5.1 Kyuden Masahiro
whoami • Name: Kyuden Masahiro • Github: kyuden • Twitter:
@kyuden_ • Gems: – sorcery: committer • https://github.com/Sorcery/sorcery – banken : creator • https://github.com/kyuden/banken
5 分で Web サービスを 30 ヶ国語対応
None
Rails 5.1 の新機能 / 変更点を一部紹介しますが、最後に脱線します
form_with
form_with • form_for と form_tag が form_with に統 合された –
統合だけでなく、いくつか改善も行われており form_for や form_tag と少しデフォルトの挙動 が違うので注意が必要 – form_for と form_tag は今後 deprecate にな る予定
form_with `model:` を使うと form_for のようなモデ ルに基づいたフォームが生成できる
form_with `url:` を使うと form_tag のようなモデルに 基づかないフォームを生成できる
Why?
form_with https://github.com/rails/rails/issues/25197
form_with • form_with はデフォルト `remote: true` • 次の設定を false に設定することでデフォルトを
local: true に変更できる config.action_view.form_with_generates_remote_ forms = false
Why?
form_with https://github.com/rails/rails/issues/25197
form_with • form_with はデフォルトで form タグや Input タグに class 属性や
id 属性を付与しない
Why?
form_with https://github.com/rails/rails/issues/25197
form_with • form_with で form タグに class 属性や id 属
性などの HTML 属性を付与する際 `html{}` で ラップする必要はない
Why?
form_with https://github.com/rails/rails/issues/25197
form_with • form_with はモデルの属性に存在しないフィー ルドを FormBuilder オブジェクト経由で指定で きる
Why?
form_with https://github.com/rails/rails/issues/25197
Encrypted secrets
Encrypted secrets • config/secrets.yml とは別に秘匿情報を管 理する仕組み • 暗号化して管理できることが特徴
Encrypted secrets bin/rails secrets:setup
Encrypted secrets EDITOR=vim bin/rails secrets:edit
Encrypted secrets • 暗号化 / 複合のための鍵は config/secrets.yml.key に定義する以外に 環境変数 $RAILS_MASTER_KEY
に設定す ることも可能 • Rails5.1 で新規に作られたアプリ以外はデフ ォルトでは Encrypted secrets を読み込む 以下の設定が false になっているので注意 config.read_encrypted_secrets = true • 暗号化方式は aes-128-gcm
Why?
Encrypted secrets • config/secrets.yml に秘匿情報をベタ書きす るとセキュリティ的にバージョン管理できない ⬇ 秘匿情報ごとに環境変数を用意し実際の値は外部の リポジトリやサービスで管理するなどして運用 ⬇
しかし、アプリケーションコードと秘匿情報の管理 場所が異なると、どの時点のアプリケーションコー ドがどのような秘匿情報を必要とするのか把握する のが難しい ( 工夫が必要 ) ⬇ そう考えると、アプリケーションコードと共にバー ジョン管理できた方がいい ⬇ バージョン管理するためには暗号化が必要 ◦ そこで Encrypted secrets
Encrypted secrets • なぜ config/secrets.yml は 5.1 でも残っているのか • なぜフォーマットは
YAML なのか、 etc https://github.com/rails/rails/issues/25095
Keep Motivation
Keep Motivation ⬇ そこそこ長く Rails( 特定のフレームワーク ) を 使って詳しくなると Rails
への興味が徐々に薄れ ていく ( 自分の場合は ) 。 ⬇ Rails の新バージョンがリリースされると、新し い機能や変更点は一応確認するが、 Rails の知識 がついても自分の力になっている感じがしない ( 興味が薄れるとなおさらそう感じる ) 。
Keep Motivation ⬇ DHH などがたてた新しい機能や大きな変更点の案 が記載された ISSUE やコメントでの議論を読んで その Why
を知ると、いろいろな学びがある。 ⬇ そこで得た学びは Rails に限らず、他のフレーム ワークを使う場合や、設計で悩んだ際にも応用でき る。 ⬇ Rails に慣れて取れ高が少なくなってきた方なんか は、 ISSUE やコメントでの議論の内容がよくわか ると思うので特に楽しめるかも? ◦ モチベーションを保てる!
Rails 5.1 の新機能 / 変更点 全然紹介できてない ..
続きは WEB+DB PRESS で !