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
Kyuden Masahiro
June 28, 2017
Programming
790
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
Claude CodeとAgentCore Gatewayを繋ぐ際の認証認可 / Authentication and authorization when connecting Claude Code with AgentCore Gateway
har1101
2
270
Flow は今どうなっているか
mizdra
PRO
0
280
5分で問診!Composer セキュリティ健康診断
codmoninc
0
980
言葉の格闘技のススメ~紙とペンと言葉から始める、キャリアの描き方~
progresscicada
2
140
Go言語とトイモデルで学ぶTransformerの気持ち / fukuokago23-transformer
monochromegane
0
170
「人を評価する AI」の設計と実装
ryoyanara
0
200
PHP に部分適用が来るぞ!……ところで何それ?おいしいの? #phpcon / phpcon-2026
shogogg
0
640
TSX の <Hoge<Fuga>> という構文に驚いた話 / tsx-type-argument-syntax
kanaru0928
0
230
AI Engineeringは、AIプロダクトだけのものか? 〜AIがソフトウェアを作る時代の新しい当たり前〜 / No AI in your product. AI Engineering in your development.
rkaga
4
410
AI Readyの正体はデータマネジメントだ メダリオン2.0の最前線
freee
PRO
0
220
【QA Test Talk Vol.8】AI-DLC による Whole Team Approach の加速
pkshadeck
PRO
0
180
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
570
Featured
See All Featured
How GitHub (no longer) Works
holman
316
150k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
480
Into the Great Unknown - MozCon
thekraken
41
2.7k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
200
The Limits of Empathy - UXLibs8
cassininazir
1
600
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
420
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
380
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
280
Darren the Foodie - Storyboard
khoart
PRO
3
3.6k
Discover your Explorer Soul
emna__ayadi
2
1.3k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
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 で !