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
Form objects
Search
Roman Dubrovsky
June 16, 2016
Programming
1
160
Form objects
Roman Dubrovsky
June 16, 2016
Tweet
Share
More Decks by Roman Dubrovsky
See All by Roman Dubrovsky
Life with GraphQL
roman_dubrovsky
0
140
Timezone pain (lighting)
roman_dubrovsky
0
26
Feature toggling
roman_dubrovsky
0
50
GraphQl paratemers (lightning)
roman_dubrovsky
0
12
Views and Controllers, Forms
roman_dubrovsky
0
14
Railway Oriented Programming
roman_dubrovsky
0
76
Git tips
roman_dubrovsky
0
51
Cells refactroing
roman_dubrovsky
0
28
Other Decks in Programming
See All in Programming
AmperとFleetを使ったAndroidアプリ
yoppie
0
270
if constexpr文はテンプレート世界のラムダ式である
faithandbrave
3
690
デフォルトにして至高、RubyMineの大好きな所
ruzia
0
980
検証も兼ねて個人開発でHonoとかと向き合った話
hanetsuki
1
1.4k
初心者のためのRubyKaigi入門/RubyKaigi Introduction
a_matsuda
10
1.6k
Go製Webアプリケーションのエラーとの向き合い方大全、あるいはやっぱりスタックトレース欲しいやん / Kyoto.go #50
utgwkk
6
1.8k
Three ways to use AI on Android: The Good, the Bad and the Ugly
marxallski
0
110
Fast JSX: Don't clone props object #28768
yossydev
1
200
Snowflakeで眠ったデータを起こそう!
estie
0
160
『Railsオワコン』と言われる時代に、なぜブルーモ証券はRailsを選ぶのか
free_world21
1
390
Amazon SQSコンシューマー疎結合への旅 - 出張! #DevelopersIO IT技術ブログの中の人が語る勉強会 #3
quiver
0
330
Elm Form Validation
bkuhlmann
0
520
Featured
See All Featured
Designing on Purpose - Digital PM Summit 2013
jponch
111
6.5k
Designing the Hi-DPI Web
ddemaree
276
33k
Optimising Largest Contentful Paint
csswizardry
13
2.4k
[RailsConf 2023] Rails as a piece of cake
palkan
28
4k
Fantastic passwords and where to find them - at NoRuKo
philnash
39
2.5k
Navigating Team Friction
lara
179
13k
Building a Modern Day E-commerce SEO Strategy
aleyda
22
6.4k
How to name files
jennybc
65
93k
Typedesign – Prime Four
hannesfritz
36
2.1k
The Cost Of JavaScript in 2023
addyosmani
21
3.9k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
155
14k
Happy Clients
brianwarren
92
6.4k
Transcript
Form Objects
None
User model
None
None
None
None
https://github.com/apotonick/reform
Defining form
Defining form Building form
Defining form Building form Using form
Defining form Building form Using form Using form
Form objects can: • Mapping attributes from models to form
• Define validations for form • Simple render form’s attributes
Form object is easy
1st case
1st case
Using form
Rendering form
accepts_nested_attributes_for:
2nd case accept_nested_attributes_for cocoon
Without form objects
None
With form objects
Move validations out of models
3rd case
None
With form object it’s easy
4th case
None
None
Using forms
Summary • Form objects can mapping attributes from models to
form • Form objects defining validations for form • Simple render form’s attributes with form objects • No validations in model
None
Pros • New abstraction • Clean models • No more
conditional validations • No more conditional params permissions
Cons • New abstraction • More code • Human factor
None
ПОТРАЧЕНО