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
Transcript
10 slides
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
More Decks by Jesse Wolgamott
See All by Jesse Wolgamott
React vs React-Native
jwo
0
160
What is an API
jwo
0
240
DIY Rails Authentication
jwo
0
260
ActionCable - For Not Another Chat App
jwo
3
1.9k
SlackBot.rb - Create You a Slack Bot
jwo
1
1.5k
react-rails: an isomorphic match made in heaven
jwo
0
1.5k
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
JAWS_FESTA2026_オンプレ-AWS間プロキシサーバの移行_性能_障害対応で得た実践ノウハウ_高島一晃.pdf
tkazuaki0820
1
120
An Introduction to Context Ontology Accelerator (teaching AI agents what your data means)
inariku
PRO
1
250
Steering と Hook (チームの決まりを守らせる) | 目指せ Kiro マスター 06
inariku
PRO
2
120
Intro to Kiro (One agent, every surface) | Kiro: Zero to Hero 01
inariku
PRO
2
130
Where Should Platform Complexity Live? Lessons from a Cross-Team PR Preview Platform
taiki45
0
110
「任されビリティ」で引き受けて「よしなりてぃ」に頼らず任せる / Accept tasks with "makasarebility" and hand them over without relying on "yoshinarily"
pauli
0
540
落とし穴にハマってわかった 開発生産性を測るときに気をつけたいこと
munakata
1
160
顧客合意を取りながら進めるAWSコスト削減の実践
optim
0
170
MCPでネットワーク障害調査を自動化する前に直すべき3つのこと
yama3133
0
200
Linuxネットワークスタック進化の軌跡: 過去10年の歩みと最新トレンド
orimanabu
4
640
マネージャーをエスパーにしない マネジメントされる側から始める、働きやすい現場づくり
comi190327
0
370
Gemma4 Hands-on at Nagoya
tsho
0
100
Featured
See All Featured
Fantastic passwords and where to find them - at NoRuKo
philnash
53
4k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
600
Everyday Curiosity
cassininazir
0
400
Paper Plane (Part 1)
katiecoart
PRO
3
12k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
203
77k
The Spectacular Lies of Maps
axbom
PRO
1
1.1k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
1
310
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
630
WCS-LA-2024
lcolladotor
0
1k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
Mobile First: as difficult as doing things right
swwweet
225
10k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
320