From f7fb11ed852fb2d0ca6794762b42406c73154f6b Mon Sep 17 00:00:00 2001 From: Mike Dvorkin Date: Wed, 2 Feb 2011 22:19:05 -0800 Subject: [PATCH] Make sure active_record and active_support mixins get loaded in Rails console when required from .irbrc --- lib/ap.rb | 11 +++++++---- lib/awesome_print.rb | 11 +++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/ap.rb b/lib/ap.rb index 8400044..72637bc 100755 --- a/lib/ap.rb +++ b/lib/ap.rb @@ -8,7 +8,10 @@ end require File.dirname(__FILE__) + "/ap/awesome_print" -require File.dirname(__FILE__) + "/ap/core_ext/logger" if defined?(::Logger) -require File.dirname(__FILE__) + "/ap/mixin/action_view" if defined?(::ActionView) -require File.dirname(__FILE__) + "/ap/mixin/active_record" if defined?(::ActiveRecord) -require File.dirname(__FILE__) + "/ap/mixin/active_support" if defined?(::ActiveSupport) +require File.dirname(__FILE__) + "/ap/core_ext/logger" if defined?(Logger) +require File.dirname(__FILE__) + "/ap/mixin/action_view" if defined?(ActionView) + +# Load the following under normal circumstatnces as well as in Rails +# console when required from ~/.irbrc. +require File.dirname(__FILE__) + "/ap/mixin/active_record" if defined?(ActiveRecord) || (defined?(IRB) && ENV['RAILS_ENV']) +require File.dirname(__FILE__) + "/ap/mixin/active_support" if defined?(ActiveSupport) || (defined?(IRB) && ENV['RAILS_ENV']) diff --git a/lib/awesome_print.rb b/lib/awesome_print.rb index cb7af89..2d4aed5 100755 --- a/lib/awesome_print.rb +++ b/lib/awesome_print.rb @@ -15,7 +15,10 @@ end require File.dirname(__FILE__) + "/ap/awesome_print" -require File.dirname(__FILE__) + "/ap/core_ext/logger" if defined?(::Logger) -require File.dirname(__FILE__) + "/ap/mixin/action_view" if defined?(::ActionView) -require File.dirname(__FILE__) + "/ap/mixin/active_record" if defined?(::ActiveRecord) -require File.dirname(__FILE__) + "/ap/mixin/active_support" if defined?(::ActiveSupport) +require File.dirname(__FILE__) + "/ap/core_ext/logger" if defined?(Logger) +require File.dirname(__FILE__) + "/ap/mixin/action_view" if defined?(ActionView) + +# Load the following under normal circumstatnces as well as in Rails +# console when required from ~/.irbrc. +require File.dirname(__FILE__) + "/ap/mixin/active_record" if defined?(ActiveRecord) || (defined?(IRB) && ENV['RAILS_ENV']) +require File.dirname(__FILE__) + "/ap/mixin/active_support" if defined?(ActiveSupport) || (defined?(IRB) && ENV['RAILS_ENV'])