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
do-not-delete-softly
Search
MOROHASHI Kyosuke
August 31, 2015
Programming
13
34k
do-not-delete-softly
MOROHASHI Kyosuke
August 31, 2015
Tweet
Share
More Decks by MOROHASHI Kyosuke
See All by MOROHASHI Kyosuke
Simplicity on Rails -- RDB, REST and Ruby
moro
13
15k
ちょうどよい Rails E2E テスト/enough-good-rails-e2e-test
moro
5
2.2k
フレームワークを作らない方法/How NOT to build frameworks
moro
4
1k
全体がいい感じになるために、私たちRailsをホームにするWeb技術者ができること/let-our-whole-system-grow
moro
2
1.8k
フォームオブジェクトとの向き合い方/Grow Form Objects up
moro
1
1.8k
チームによるいきいきとしたソフトウェア開発/an-alive-team-grows-software
moro
3
3.3k
Web-E2E-Testing-from-Ruby
moro
5
480
Joyful user foundation restructuring with Ruby
moro
9
19k
cookpad-17day-tech-internship-2017-git
moro
0
9.4k
Other Decks in Programming
See All in Programming
Method Swizzlingを行うライブラリにおけるマルチモジュール設計
yoshikma
0
120
Increased Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
450
Jakarta EE meets AI
ivargrimstad
0
400
KSPの導入・移行を前向きに検討しよう!
shxun6934
PRO
0
290
AndroidアプリのUIバリエーションをあの手この手で確認する / Check UI variations of Android apps by various means
tkmnzm
1
200
オートマトン学習しろ / Do automata learning
makenowjust
3
130
Developer Joy == Developer Productivity (really!)
hollycummins
1
240
マルチモジュールにおけるテスト最適化
fxwx23
0
210
Why Prism?
kddnewton
4
1.7k
Rechartsで楽にゴリゴリにカスタマイズする!
10tera
1
170
Kotlin 2.0 and Beyond
antonarhipov
2
150
Google Sign-inの移行から始めるCredential Manager活用
clockvoid
0
430
Featured
See All Featured
Learning to Love Humans: Emotional Interface Design
aarron
270
40k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Debugging Ruby Performance
tmm1
72
12k
Thoughts on Productivity
jonyablonski
66
4.2k
Building a Modern Day E-commerce SEO Strategy
aleyda
36
6.8k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
Unsuck your backbone
ammeep
667
57k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
36
2.1k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
89
16k
What's in a price? How to price your products and services
michaelherold
242
11k
[RailsConf 2023] Rails as a piece of cake
palkan
48
4.6k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
45
4.8k
Transcript
ཧআΛ ͠ͳ͍ 2015-08-31 ཧআCasual Talks #1 @moro
ॾڮګհ(@moro) Kyosuke MOROHASHI
None
None
͍͑ͨ͜ͱ
ཧআͳΜͯ ͳ͔ͬͨ
‣আ͍ͯ͠ͳ͍ ‣আ͍ͯ͠ͳ͍ͷͰআͱ ݺͿ͖Ͱͳ͍ɻ ‣ͥΜͥΜཧతͰsoftͰ ͳ͍.
ཧআΛ ͨ͘͠ͳΔͱ͖
ઈ൛ʹ আϑϥάΛ͚͍ͨ
࣮ݱ͍ͨ͜͠ͱ ‣ ઈ൛ͨ͠Λཧআͯ͠ɺ ҰཡݕࡧͰදࣔ͞Εͳ͍Α ͏ʹ͍ͨ͠ɻ ‣ ৽͘͠ߪೖͰ͖ͳ͍ͨ͘͠ɻ
ຊʹ”আ”ͳͷ͔? ‣աڈʹങͬͨސ٬ͷߪങཤ ྺʹදࣔ͢Δ ‣ച্ूܭͷରʹͳΔ
΄Μͱ͏ʹཉ͔ͬͨ͠ͷ status = :ઈ൛
class Product < AR::Base scope :sellable, -> { where.not(status: :絶版)
} end class ProductsController < AppC def index @products = Product.sellable.order(nantoka) end end class Backroom::ProductsController < AppC def index @products = Product.order(kantoka) end end
default_scope :sellable ඇਪɻʮσϑΥϧτʯ ͡Όͳ͍Ͱ͢͠
class Order < AR::Base default_scope -> { where(deleted_at: nil }
end # 忘れた頃に def clean_old_orders(orders) orders.unscoped.destroy_all # さらに忘れた頃に clean_old_orders(Order.where(company_id: 42))
ୀ৬ͨ͠ձһʹ আϑϥάΛ͚͍ͨ
࣮ݱ͍ͨ͜͠ͱ ‣ୀձͨ͠ձһɺ ϩάΠϯग़དྷͳ͍Α͏ʹɺ ཧআ͍ͨ͠
ຊʹ”আ”ͳͷ͔? ‣ ͦͷձһͷσʔλͲ͏ͳΔ? ‣ a: ͥΜͿফ͢ ‣ b: ͦͷ··͢ ‣
c: ಗ໊ͱͯ͢͠ ‣ d: γεςϜϢʔβ͚ସ͑
ຊʹ”আ”ͳͷ͔? ‣a: ͥΜͿফ͢ ‣ ফ͠·͠ΐ͏!!! ‣ ෆ҆ͳΒඞཁͳͱ͜Ζ͚ͩ ΞʔΧΠϒ
ຊʹ”আ”ͳͷ͔? ‣b: ͦͷ··͢ ‣ ୀձձһΛ status = :ログイ ン不可 ʹ͢Δ
(statusͦΕͦΕͰ pros/cons ͋Δͷͷ…) ‣ೝূใ͚ͩফ͢
ຊʹ”আ”ͳͷ͔? ‣c: ಗ໊ͱͯ͢͠ ‣ݸਓใͳͲΛফ͢Α͏ɺ ॲཧΛ͢
ຊʹ”আ”ͳͷ͔? ‣ d: γεςϜϢʔβ͚ସ͑ ‣ͦ͏͍͏ॲཧΛ͢
ຊʹ”আ”ͳͷ͔? ‣ a: Ҏ֎ʮআʯ͍ͯ͠ͳ͍ ‣ a: Ұॹʹফ͢ ‣ b: ͦͷ··͢
‣ c: ಗ໊ͱͯ͢͠ ‣ d: γεςϜϢʔβ͚ସ͑
ʮཧআʯͰͳ͘ Γ͍ͨ͜ͱʹԊͬͨઃܭΛ
อظݶͷ ա͗ͨσʔλʹ আϑϥάΛ͚͍ͨ
࣮ݱ͍ͨ͜͠ͱ ‣ҰఆظؒҎ্ݹ͍σʔλΛ ཧআ͠ɺҰཡʹදࣔ͞ Εͳ͍ͨ͘͠ɻ
ຊʹ”আ”ͳͷ͔? ‣ ϩάΛऔͬͯফ͢ɻ ‣ আͰ͖ͦ͏ɻ ‣ ࠪʹඞཁetcͳͲͳΒ͢ɻ
ຊʹ”আ”ͳͷ͔? ‣ٯʹߟ͑Δɻ ‣ Ұཡʹදࣔ͢Δ߲Λ ৽͍͠ͷ͚ͩʹ͢Δɻ ‣ σʔλྔͷݒ೦ͱɺUXͷ ݒ೦ͦΕͧΕผͷɻ
default_scope と同じ問題 一番最初の画面に出すもの、が デフォルトなわけではない。
ͳͥཧআΛ ͖͢Ͱͳ͍ͷ͔ (reprise)
‣ࢭΊ͕࣌Θ͔Βͳ͍ɻ ‣ શςʔϒϧʹআϑϥά ‣ ͭͶʹJOINͯ͠ϑϥάνΣοΫ
‣σʔλͷऴΘΓΛ ઃܭͰ͖͍ͯͳ͍ɻ ‣ઃܭͰ͖͍ͯͳ͍ͷͰ ࢭΊ͕ܾ࣌ΊΒΕͳ͍ɻ
ͳͷʹʮཧআʯͰ Կ͔ΛݴͬͨงғؾʹͳΔɻ ࢛จࣈख़ޠ͜Θ͍ɻ
ཧআΛ ͠ͳ͍
‣σʔλͷʮऴΘΓํʯΛ ;ͭ͏ʹઃܭ͢Δɻ ‣࢛จࣈख़ޠͰԿ͔Λ ݴͬͨؾʹͳΒͳ͍ɻ
͋ΘͤͯಡΈ͍ͨ: http://qiita.com/Jxck_/items/156d0a231c6968f2a474
‣σʔλͷʮऴΘΓํʯΛ ;ͭ͏ʹઃܭ͢Δɻ ‣࢛จࣈख़ޠͰԿ͔Λ ݴͬͨؾʹͳΒͳ͍ɻ