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
6
10k
Simplicity on Rails -- RDB, REST and Ruby
moro
14
16k
ちょうどよい 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.8k
フォームオブジェクトとの向き合い方/Grow Form Objects up
moro
1
1.9k
チームによるいきいきとしたソフトウェア開発/an-alive-team-grows-software
moro
3
3.3k
Web-E2E-Testing-from-Ruby
moro
5
500
Joyful user foundation restructuring with Ruby
moro
9
19k
Other Decks in Programming
See All in Programming
Macとオーディオ再生 2024/11/02
yusukeito
0
370
距離関数を極める! / SESSIONS 2024
gam0022
0
290
エンジニアとして関わる要件と仕様(公開用)
murabayashi
0
300
flutterkaigi_2024.pdf
kyoheig3
0
150
Outline View in SwiftUI
1024jp
1
330
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
890
OnlineTestConf: Test Automation Friend or Foe
maaretp
0
110
色々なIaCツールを実際に触って比較してみる
iriikeita
0
330
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
120
Better Code Design in PHP
afilina
PRO
0
130
Tauriでネイティブアプリを作りたい
tsucchinoko
0
370
Ethereum_.pdf
nekomatu
0
460
Featured
See All Featured
A Tale of Four Properties
chriscoyier
156
23k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Teambox: Starting and Learning
jrom
133
8.8k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
44
2.2k
Bash Introduction
62gerente
608
210k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
Faster Mobile Websites
deanohume
305
30k
How STYLIGHT went responsive
nonsquared
95
5.2k
Navigating Team Friction
lara
183
14k
Statistics for Hackers
jakevdp
796
220k
Designing Experiences People Love
moore
138
23k
What's new in Ruby 2.0
geeforr
343
31k
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
‣σʔλͷʮऴΘΓํʯΛ ;ͭ͏ʹઃܭ͢Δɻ ‣࢛จࣈख़ޠͰԿ͔Λ ݴͬͨؾʹͳΒͳ͍ɻ