Permalink
Browse files

move some cool helpers out of burndown and into things that are loade…

…d in console
  • Loading branch information...
1 parent 627ab0e commit d267953f640a1fd3fc5de4bb058aed9c5234b37c @janxious janxious committed Mar 19, 2010
Showing with 14 additions and 0 deletions.
  1. +8 −0 .irbrc.d/array.rb
  2. +6 −0 .railsrc.d/active_record.rb
View
@@ -0,0 +1,8 @@
+class Array
+ # will allow stuff like foo.bars.map(&[:x, :y, :z])
+ def to_proc
+ Proc.new do |obj, *args|
+ self.map { |method| obj.send(method) }
+ end
+ end
+end
@@ -5,3 +5,9 @@ def db_inspect
end
nil
end
+
+class ActiveRecord::Base
+ def self.[](*args)
+ self.find(*args)
+ end
+end

0 comments on commit d267953

Please sign in to comment.