Class: ActiveRecord::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/gimme_a_break.rb

Overview

Reopening ActiveRecord::Base not bad, see http://yehudakatz.com/2009/11/12/better-ruby-idioms/

Class Method Summary collapse

Class Method Details

.gimme_a_break(options = {}) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/gimme_a_break.rb', line 21

def self.gimme_a_break(options ={})
  cattr_accessor :gimme_a_break_timeout
  self.gimme_a_break_timeout = (options[:timeout] || 6)
  
  if Rails.env.production?
    include GimmeABreak
  
    class_eval "      validate :gimme_a_break\n    EOV\n  end\nend\n"