SlideShare a Scribd company logo
Stupid things I’ve done
Stupid things I’ve done
       In Ruby and Rails
Bert Goethals
Bert Goethals
We all make mistakes

     That drink, that girl, the morning after



That chicken, the biting, mom laughing her ass off
But we learn

Drink less or pass out



Don’t pee on chickens
Ruby and Rails
8
Mistakes for you to learn from
acts_as_inherit
Hacking rails to
combine 2 models in
    one model
• Modify default queries
• Provide setters / getters for “inherited”
  attribbutes

• Allow validation and errors on “inherited”
  attribbutes

• All transparent
Rails goes from
   1.1 to 1.2
• Modify default queries
• Provide setters / getters for “inherited”
  attribbutes

• Allow validation and errors on “inherited”
  attribbutes

• All transparent
Don’t hack rails internals
acts_as_taggable
     _on_steroids
Lot of overhead for a list of words

•   Two extra tables

•   SQL isn’t meant for search

•   ActiveRecord Model overload!
Save the list of words
•   No extra query for tags

•   Search with Sphinx

•   Generate tagclouds separately
Fighting ::NameSpaces
REST principal
   But not always
attr_protected
      and

attr_accessible
Controllers should
 control requests
Flame shield Up!
Prototype
Use jQuery
  or MooTools
Mephisto
Anything else!
  or Wordpress (PHP)
ActiveRecord
ActiveRecord
  For batch processing
ActiveRecord = Lots of memory
      Batch = Lots of stuff

    ActiveRecord + Batch =
   Lots and Lots of Memory
Use DataMapper
  or write your own queries
alias_attribute
alias_attribute
    Not using it
  def name
    read_attribute(:title)
  end
 
  def name=(value)
    write_attribute(:title, value)
  end
    alias_attribute :name, :title
R.T.F.M.
Conclusions
  and questions?

More Related Content

PDF
Mistakes
ZIP
Mistakes I've made in Ruby and Rails
PDF
10 Things You Didn't Know that Postman Can Do
PPTX
Introduction to testing in Rails
PDF
POST/CON 2019 - 10 Things You Didn't Know That Postman Can Do (Slides)
PDF
A Test Code Generator for RSpec Users
PDF
RSpec 2 Best practices
PPTX
RSpec and Rails
Mistakes
Mistakes I've made in Ruby and Rails
10 Things You Didn't Know that Postman Can Do
Introduction to testing in Rails
POST/CON 2019 - 10 Things You Didn't Know That Postman Can Do (Slides)
A Test Code Generator for RSpec Users
RSpec 2 Best practices
RSpec and Rails

Viewers also liked (20)

PPTX
Blogging and How It Complements Your Marketing Strategy
PPT
Pagina Web Arco Iris
XLS
Estadistica
PPT
Tips For Choosing An Executor In Your Will
PPT
Education 2.0: Innovation, Collaboration, Celebration via Effortless Integration
PPT
Tmd Portfolio 1
PPTX
Analisia Eta Proposamenak
PPTX
Itgrammar
PDF
Conference Group 2
PDF
trialpdf
PDF
(元)高専生が語るキーボードブラウジング@Opera
PPS
JBS Power Point Presentatie
PPT
4.Experteam Hazine Sunum Ver Oracle Day Poas Final
PPTX
The Effects of Work Habits Around Agility Through Simulations
ODP
Business Proprosal Slide
PPT
Build Boston 2009 Bd New Econ
PDF
PDF
Truvada kaletra o maraviroc PrEp
PPS
Brasil Deadly Landslide 0111
PDF
Blogging and How It Complements Your Marketing Strategy
Pagina Web Arco Iris
Estadistica
Tips For Choosing An Executor In Your Will
Education 2.0: Innovation, Collaboration, Celebration via Effortless Integration
Tmd Portfolio 1
Analisia Eta Proposamenak
Itgrammar
Conference Group 2
trialpdf
(元)高専生が語るキーボードブラウジング@Opera
JBS Power Point Presentatie
4.Experteam Hazine Sunum Ver Oracle Day Poas Final
The Effects of Work Habits Around Agility Through Simulations
Business Proprosal Slide
Build Boston 2009 Bd New Econ
Truvada kaletra o maraviroc PrEp
Brasil Deadly Landslide 0111
Ad

Similar to Mistakes (20)

PDF
Introduction to Writing Readable and Maintainable Perl (YAPC::EU 2011 Version)
KEY
Developer testing 201: When to Mock and When to Integrate
KEY
Testing gone-right
PPT
VodQA_ParallelizingCukes_AmanKing
PPT
Reducing Build Time
PPT
VodQA_Parallelizingcukes_AmanKing
PDF
ITB2017 - Slaying the ORM dragons with cborm
KEY
Rails is Secure
PDF
Avoiding Common Pitfalls in Ember.js
PDF
ABRIDGED VERSION - Joys & frustrations of putting 34,000 lines of Haskell in...
PDF
Bringing Concurrency to Ruby - RubyConf India 2014
PDF
Future of Ruby on the Web
PDF
Introduction to writing readable and maintainable Perl
PDF
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
KEY
Erlang - Dive Right In
KEY
Code Fast, Die Young, Throw Structured Exceptions
PDF
Free The Enterprise With Ruby & Master Your Own Domain
PDF
Get Slim!
PDF
Lua pitfalls
PDF
Django at Scale
Introduction to Writing Readable and Maintainable Perl (YAPC::EU 2011 Version)
Developer testing 201: When to Mock and When to Integrate
Testing gone-right
VodQA_ParallelizingCukes_AmanKing
Reducing Build Time
VodQA_Parallelizingcukes_AmanKing
ITB2017 - Slaying the ORM dragons with cborm
Rails is Secure
Avoiding Common Pitfalls in Ember.js
ABRIDGED VERSION - Joys & frustrations of putting 34,000 lines of Haskell in...
Bringing Concurrency to Ruby - RubyConf India 2014
Future of Ruby on the Web
Introduction to writing readable and maintainable Perl
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
Erlang - Dive Right In
Code Fast, Die Young, Throw Structured Exceptions
Free The Enterprise With Ruby & Master Your Own Domain
Get Slim!
Lua pitfalls
Django at Scale
Ad

More from ArrrrCamp (14)

PDF
Arrrrcamp Radiant Intro
KEY
Ruby 1.9 And Rails 3.0
PDF
Metaprogramming + Ds Ls
PDF
Rubyandrails
PDF
Nanoc
PDF
Radiant
PDF
Railsservers
PDF
Prawn
PDF
Testing
PDF
Validation
PDF
Cucumber
PDF
Ruby and Rails Basics
PDF
Caching your rails application
PDF
Advanced Radiant
Arrrrcamp Radiant Intro
Ruby 1.9 And Rails 3.0
Metaprogramming + Ds Ls
Rubyandrails
Nanoc
Radiant
Railsservers
Prawn
Testing
Validation
Cucumber
Ruby and Rails Basics
Caching your rails application
Advanced Radiant

Recently uploaded (20)

PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPT
Teaching material agriculture food technology
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Modernizing your data center with Dell and AMD
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
MYSQL Presentation for SQL database connectivity
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
KodekX | Application Modernization Development
PDF
Machine learning based COVID-19 study performance prediction
PDF
NewMind AI Weekly Chronicles - August'25 Week I
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Advanced methodologies resolving dimensionality complications for autism neur...
Chapter 3 Spatial Domain Image Processing.pdf
Teaching material agriculture food technology
Unlocking AI with Model Context Protocol (MCP)
20250228 LYD VKU AI Blended-Learning.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
“AI and Expert System Decision Support & Business Intelligence Systems”
Modernizing your data center with Dell and AMD
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
MYSQL Presentation for SQL database connectivity
The AUB Centre for AI in Media Proposal.docx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Spectral efficient network and resource selection model in 5G networks
NewMind AI Monthly Chronicles - July 2025
Network Security Unit 5.pdf for BCA BBA.
KodekX | Application Modernization Development
Machine learning based COVID-19 study performance prediction
NewMind AI Weekly Chronicles - August'25 Week I

Mistakes