Permalink
Browse files

Add boolean field to rails extensions

  • Loading branch information...
1 parent 1571c42 commit 1eb9ff2b5282ccf98b3f4c9ae2d88226d103a17c @UnderpantsGnome committed May 17, 2007
Showing with 10 additions and 0 deletions.
  1. +10 −0 lib/rails_extensions.rb
@@ -1,3 +1,13 @@
+module ActiveRecord
+ class Base
+ class << self
+ def boolean_field(*args)
+ args.each {|prop| class_eval("def #{prop}?; #{prop} === true || #{prop} === 1 end") }
+ end
+ end
+ end
+end
+
module ActionController
class AbstractRequest
def referrer

0 comments on commit 1eb9ff2

Please sign in to comment.