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 is Just Ruby
Search
Jesse Wolgamott
April 29, 2013
Programming
550
1
Share
Rails is Just Ruby
RailsConf 2013 - Intro Track
Jesse Wolgamott
April 29, 2013
More Decks by Jesse Wolgamott
See All by Jesse Wolgamott
React vs React-Native
jwo
0
150
What is an API
jwo
0
210
DIY Rails Authentication
jwo
0
240
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
1k
Ruby 2.1 Overview
jwo
0
1.1k
Rails 4: Appetizers
jwo
1
1.1k
Other Decks in Programming
See All in Programming
inferと仲良くなる10分間
ryokatsuse
1
310
Technical Debt: Understanding it Rightly, Engaging it Rightly #LaravelLiveJP
shogogg
0
180
Lemonade + Foundry Toolkit でお手軽アプリ開発
seosoft
1
260
Oxlintはいかにしてtsgolintのlint ruleを呼び出しているのか
syumai
2
1.1k
初めてのRubyKaigiはこう見えた
jellyfish700
0
390
柔軟なPDFレイアウトエディタを支える型システム設計 — Discriminated UnionとConditional Typeの実践
minako__ph
4
1.2k
サーバーレスで作る、動画データ管理基盤
oyasumipants
0
330
Zod v4 Codec でスキーマに型変換を埋め込む REST API 設計 #TSKaigi2026
ryutaro_yako
0
180
JavaDoc 再入門
nagise
0
230
技術記事、AIに書かせるか、自分で書くか? 〜それでも私が自分の手で書く理由〜 / #QiitaConference
jnchito
2
1.2k
These Five Tricks Can Make Your Apps Greener, Cheaper, & Nicer
hollycummins
0
260
Transactional Change Stream Processing With Debezium and Apache Flink
gunnarmorling
1
150
Featured
See All Featured
Tell your own story through comics
letsgokoyo
1
940
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
130
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
190
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.4k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
300
The browser strikes back
jonoalderson
0
1.1k
[SF Ruby Conf 2025] Rails X
palkan
2
1.1k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.7k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.5k
Transcript
Ruby is Just Rails A Guide to Procrastination and Happiness
Stu Rails makes insanely easy Seemingly Magical
Protect entire system from unauthorized requests Seemingly Magical
Log every page load Seemingly Magical
Update full-text search engine every time a record is added
Seemingly Magical
it’s not magic Magic It’s not magic (maybe at first)
http:/ /lotr.wikia.com/wiki/File:Gandalf-2.jpg
http:/ /www.ibeta.eu/blog/darth-vader-on-tedxeutropolis/
Wizard Like Powers Business People consider us wizards with our
ability to create business value
Rails Helps us Along Rails helps us along
Rails Helps us Along Blocks
Rails Helps us Along Before Filters
Rails Helps us Along Callbacks
Rails Helps us Along Inheritance
Rails Helps us Along It all starts with a block
The Block
10.times do puts "YOLO" end
None
@users.each do |user| <%= user.email %> end
User.create do |u| u.name = 'jwo' end
@users.map {|u| u.total_due }.sum
Rails Helps us Along code that gets delayed and executed
later
Block Rules Every Ruby method can receive a block
Block Rules The method has to yield to the block
to be e ective
Block Rules Can take parameters and won’t scream if you
send in too few
args.each do |key,value| end
Advanced Blocks Advanced Block Tips
Block Rules Don’t use ‘return’ in a block
Block Rules Use Ruby’s implicit returns instead
Advanced Blocks Add retries for volatile actions
10.times.retry do SomeNetworkCommunicationThingyHere.new end https://github.com/schneems/rrrretry
Before Filters
Before Filters Used in Controllers
Before Filters Rails actions are your interactions with users (get/post
data)
Before Filters Can be before or after
Before Filters If your before filter returns, or redirects the
action won’t happen
before_filter do |controller| unless controller.send(:logged_in?) redirect_to new_login_url end end
class ApplicationController before_filter :authenticate_user def authenticate_user unless logged_in? redirect_to new_login_url
end end end
class PostsController < AppController # already secured end
class PublicPostsController < AppController skip_before_filter :authenticate_user end
Callbacks
About Callbacks Code you can define to run later works
in Models too
About Callbacks It’s like HollaBack, but not
Callback Example Stack Overflow Example: Downcasing email
class User < ActiveRecord::Base before_validation do |user| user.email = user.email.downcase
end end
Callback Example Real World Example: Full Text Searching (websolr)
class Post < ActiveRecord::Base searchable do text :title, :body end
end https://github.com/sunspot/sunspot
Post.search do fulltext 'best pizza' end https://github.com/sunspot/sunspot
after_destroy do |searchable| searchable.remove_from_index end https://github.com/sunspot/sunspot/blob/master/ sunspot_rails/lib/sunspot/rails/searchable.rb
Workshop Time
Workshop Create a beeper alert program
Workshop Criteria if alarm is critical, send SMS
Workshop Criteria if alarm is warning, send email
I’m JWo Thanks! @jwo Jesse Wolgamott.com