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
140
What is an API
jwo
0
210
DIY Rails Authentication
jwo
0
230
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
1k
Rails 4: Appetizers
jwo
1
1.1k
Other Decks in Programming
See All in Programming
2026年のソフトウェア開発を考える(2026/05版) / Software Engineering Scrum Fest Niigata 2026 Edition
twada
PRO
23
12k
mruby on C#: From VM Implementation to Game Scripting (RubyKaigi 2026)
hadashia
2
1.8k
AIを導入する前にやるべきこと
negima
2
350
tRPCの概要と少しだけパフォーマンス
misoton665
2
270
20年以上続くプロダクトでも使い続けられる静的解析ツールを求めて
matsuo_atsushi
0
150
PHPでローカル環境用のSSL/TLS証明書を発行することはできるのか? #phpconkagawa
akase244
0
360
ハーネスエンジニアリングとは?
kinopeee
13
6.9k
クラウドネイティブなエンジニアに向ける Raycastの魅力と実際の活用事例
nealle
2
260
「OSSがあるなら自作するな」は AI時代も正しいか ── Build vs Adopt の新しい判断基準
kumorn5s
7
2.6k
Making the RBS Parser Faster
soutaro
0
710
エラー処理の温故知新 / history of error handling technic
ryotanakaya
7
1.9k
ハーネスエンジニアリングにどう向き合うか 〜ルールファイルを超えて開発プロセスを設計する〜 / How to approach harness engineering
rkaga
28
20k
Featured
See All Featured
WENDY [Excerpt]
tessaabrams
10
37k
Ruling the World: When Life Gets Gamed
codingconduct
0
220
Paper Plane (Part 1)
katiecoart
PRO
0
7.5k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
Odyssey Design
rkendrick25
PRO
2
610
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
210
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
210
Game over? The fight for quality and originality in the time of robots
wayneb77
1
170
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.1k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
390
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.5k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2k
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