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
Identifying User Idenity
moro
9
13k
Simplicity on Rails -- RDB, REST and Ruby
moro
14
17k
ちょうどよい Rails E2E テスト/enough-good-rails-e2e-test
moro
5
2.3k
フレームワークを作らない方法/How NOT to build frameworks
moro
4
1.1k
全体がいい感じになるために、私たちRailsをホームにするWeb技術者ができること/let-our-whole-system-grow
moro
2
1.9k
フォームオブジェクトとの向き合い方/Grow Form Objects up
moro
1
1.9k
チームによるいきいきとしたソフトウェア開発/an-alive-team-grows-software
moro
3
3.3k
Web-E2E-Testing-from-Ruby
moro
5
510
Joyful user foundation restructuring with Ruby
moro
9
19k
Other Decks in Programming
See All in Programming
range over funcの使い道と非同期N+1リゾルバーの夢 / about a range over func
mackee
0
110
tidymodelsによるtidyな生存時間解析 / Japan.R2024
dropout009
1
760
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
690
開発者とQAの越境で自動テストが増える開発プロセスを実現する
92thunder
1
180
htmxって知っていますか?次世代のHTML
hiro_ghap1
0
330
The rollercoaster of releasing an Android, iOS, and macOS app with Kotlin Multiplatform | droidcon Italy
prof18
0
150
プロダクトの品質に コミットする / Commit to Product Quality
pekepek
2
770
RWC 2024 DICOM & ISO/IEC 2022
m_seki
0
210
KubeCon + CloudNativeCon NA 2024 Overviewat Kubernetes Meetup Tokyo #68 / amsy810_k8sjp68
masayaaoyama
0
250
talk-with-local-llm-with-web-streams-api
kbaba1001
0
180
ソフトウェアの振る舞いに着目し 複雑な要件の開発に立ち向かう
rickyban
0
890
Full stack testing :: basic to basic
up1
1
930
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
693
190k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.9k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Reflections from 52 weeks, 52 projects
jeffersonlam
347
20k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
28
900
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Visualization
eitanlees
146
15k
Site-Speed That Sticks
csswizardry
2
190
4 Signs Your Business is Dying
shpigford
181
21k
Why Our Code Smells
bkeepers
PRO
335
57k
Designing for Performance
lara
604
68k
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
‣σʔλͷʮऴΘΓํʯΛ ;ͭ͏ʹઃܭ͢Δɻ ‣࢛จࣈख़ޠͰԿ͔Λ ݴͬͨؾʹͳΒͳ͍ɻ