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
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
Introduction to Sansan, inc / Sansan Global Development Center, Inc.
sansan33
PRO
0
3.2k
いま好きなこと 最初はそんなに好きじゃなかった #tamagawadev
nishiuma
1
220
20260906 「AWS運用入門」著者が教える、運用業務への生成AI活用入門
masaruogura
0
120
AI-DLCって実際どう? 〜聞きたいこと全部聞いてみる〜
news_it_enj
0
160
Genie Code ワークショップ 基礎編 / Genie-Code-Workshop-fundamental
databricksjapan
PRO
0
300
KAEN Company Deck
kaen
PRO
0
260
人気商品が「ちゃんと買える」をつくる ー ECの負荷改善
ykagano
1
190
みてねにおけるAI-DLC導入活動とAIドリブン開発の現在地/JAWS-UG AI-DLC #2
isaoshimizu
2
330
Bill One 開発エンジニア 紹介資料
sansan33
PRO
7
20k
Claude Codeの体系的な理解と知識のフック
oikon48
10
6.6k
KPIだけでは評価できないプロダクトが考えるべき Evalsという第二の評価系 / Beyond KPIs: Evals as a Second Evaluation Framework for Products #PdEConf
aki_iinuma
1
2.3k
プロダクト思考 × 基盤思考を AIで実現する Compound Engineering
tkc66buzz
1
140
Featured
See All Featured
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
2.6k
Designing Experiences People Love
moore
143
24k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.2k
The Pragmatic Product Professional
lauravandoore
37
7.4k
Designing for Timeless Needs
cassininazir
1
460
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
480
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.2k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
290
Documentation Writing (for coders)
carmenintech
77
5.5k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
450
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