Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Rails Essentials: simple_form
Search
Jesse Wolgamott
October 10, 2012
Technology
200
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Rails Essentials: simple_form
Houston Ruby Brigade appetizer to simple_form (rails form DSL)
Jesse Wolgamott
October 10, 2012
More Decks by Jesse Wolgamott
See All by Jesse Wolgamott
React vs React-Native
jwo
0
160
What is an API
jwo
0
230
DIY Rails Authentication
jwo
0
260
ActionCable - For Not Another Chat App
jwo
3
1.8k
SlackBot.rb - Create You a Slack Bot
jwo
1
1.5k
react-rails: an isomorphic match made in heaven
jwo
0
1.4k
Docker - next big thing
jwo
0
1.1k
Ruby 2.1 Overview
jwo
0
1.1k
Rails 4: Appetizers
jwo
1
1.1k
Other Decks in Technology
See All in Technology
実体験から学ぶ分析エージェントの開発と運⽤
recruitengineers
PRO
8
1.8k
TinyGoでオブザーバビリティ?OpenTelemetryはTinyGoで使えるのか / Is OpenTelemetry available in TinyGo environment?
ymotongpoo
2
120
自主式軟體工廠
philipz
0
250
FOSS4Gを活用した自治体業務DXの試み
470715
0
140
宣言型部分更新は何を解決しどこへ向かうのか
shuta13
0
190
AgentCoreで実践するハーネスエンジニアリング
yakumo
1
290
ai_cording_with_k8s_knowledge.pdf
mochizuki875
1
320
Execution in the Kingdom of Agents: Reflections on Abstraction and Complexity
bcantrill
0
890
今こそ知りたいAmplifyGen2
mkdev10
2
160
The seven pitfalls of AI (revised version)
ufried
0
300
3つのアプローチで目指す チームを強くするAI駆動開発
thkt
0
140
DWH の限界突破! AI エージェント向け爆速リアルタイムデータ基盤 ClickHouse
jozono
1
330
Featured
See All Featured
Heart Work Chapter 1 - Part 1
lfama
PRO
10
37k
Agile that works and the tools we love
rasmusluckow
331
22k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
400
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Build your cross-platform service in a week with App Engine
jlugia
234
19k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.5k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
520
Paper Plane
katiecoart
PRO
4
54k
A designer walks into a library…
pauljervisheath
211
25k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
30 Presentation Tips
portentint
PRO
1
420
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Transcript
SIMPLE FORM Rails Essentials: @jwo
gem “simple_form” bundle rails g simple_form:install By Platformatec (same cats
as Devise)
rails g scaffold post title body publish_on:date featured:boolean Why is
this needed? <%= simple_form_for(@post) do |f| %> <%= f.error_notification %> <div class="form-inputs"> <%= f.input :title %> <%= f.input :body %> <%= f.input :publish_on %> <%= f.input :featured %> </div> <div class="form-actions"> <%= f.button :submit %> </div> <% end %>
As Compared to <%= form_for(@post) do |f| %> <% if
@post.errors.any? %> <div id="error_explanation"> <h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2> <ul> <% @post.errors.full_messages.each do |msg| %> <li><%= msg %></li> <% end %> </ul> </div> <% end %> <div class="field"> <%= f.label :title %><br /> <%= f.text_field :title %> </div> <div class="field"> <%= f.label :body %><br /> <%= f.text_field :body %> </div> <div class="field"> <%= f.label :publish_on %><br /> <%= f.date_select :publish_on %> </div> <div class="field"> <%= f.label :featured %><br /> <%= f.check_box :featured %> </div> <div class="actions"> <%= f.submit %> </div> <% end %>
Let’s see that again <%= simple_form_for(@post) do |f| %> <%=
f.error_notification %> <div class="form-inputs"> <%= f.input :title %> <%= f.input :body %> <%= f.input :publish_on %> <%= f.input :featured %> </div> <div class="form-actions"> <%= f.button :submit %> </div> <% end %>
It’s Just a Wrapper All form_helpers in Rails apply select,
collection_select, date_select You can pass to the HTML of the form or the input
Why over Formtastic? Formtastic had a strong opinion on form
markup created You can define what markup to use with your CSS Twitter Bootstrap, Zurb Foundation, ALL CAN BE YOURS
GUESS WHAT
Associations has many throughs are now SIMPLE. f.association :categories, as:
:check_boxes
Bootstrap Integration Yes, it does this nicely And there’s a
bootstrap picker. demo (github.com/houstonruby/rails_essentials/simple_form