$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Rails Essentials: simple_form
Search
Jesse Wolgamott
October 10, 2012
Technology
1
180
Rails Essentials: simple_form
Houston Ruby Brigade appetizer to simple_form (rails form DSL)
Jesse Wolgamott
October 10, 2012
Tweet
Share
More Decks by Jesse Wolgamott
See All by Jesse Wolgamott
React vs React-Native
jwo
0
140
What is an API
jwo
0
200
DIY Rails Authentication
jwo
0
210
ActionCable - For Not Another Chat App
jwo
3
1.7k
SlackBot.rb - Create You a Slack Bot
jwo
1
1.4k
react-rails: an isomorphic match made in heaven
jwo
0
1.3k
Docker - next big thing
jwo
0
970
Ruby 2.1 Overview
jwo
0
990
Rails 4: Appetizers
jwo
1
1k
Other Decks in Technology
See All in Technology
Reinforcement Fine-tuning 基礎〜実践まで
ch6noota
0
180
MLflowダイエット大作戦
lycorptech_jp
PRO
1
110
コミューンのデータ分析AIエージェント「Community Sage」の紹介
fufufukakaka
0
490
今からでも間に合う!速習Devin入門とその活用方法
ismk
1
690
Snowflakeでデータ基盤を もう一度作り直すなら / rebuilding-data-platform-with-snowflake
pei0804
5
1.5k
Gemini でコードレビュー知見を見える化
zozotech
PRO
1
250
OCI Oracle Database Services新機能アップデート(2025/09-2025/11)
oracle4engineer
PRO
1
150
re:Invent 2025 ~何をする者であり、どこへいくのか~
tetutetu214
0
210
ガバメントクラウド利用システムのライフサイクルについて
techniczna
0
190
Databricks向けJupyter Kernelでデータサイエンティストの開発環境をAI-Readyにする / Data+AI World Tour Tokyo After Party
genda
1
110
AWS re:Invent 2025で見たGrafana最新機能の紹介
hamadakoji
0
360
学習データって増やせばいいんですか?
ftakahashi
2
330
Featured
See All Featured
What's in a price? How to price your products and services
michaelherold
246
13k
The Invisible Side of Design
smashingmag
302
51k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.9k
Practical Orchestrator
shlominoach
190
11k
Building Applications with DynamoDB
mza
96
6.8k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
10
730
Become a Pro
speakerdeck
PRO
31
5.7k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.2k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.6k
A designer walks into a library…
pauljervisheath
210
24k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
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