Skip to content

Instantly share code, notes, and snippets.

@dewski
Created April 2, 2011 19:33
Show Gist options
  • Save dewski/899801 to your computer and use it in GitHub Desktop.
Save dewski/899801 to your computer and use it in GitHub Desktop.
railsrc_path = File.expand_path('~/.railsrc')
if (ENV['RAILS_ENV'] || defined?(Rails)) && File.exist?(railsrc_path)
begin
load railsrc_path
rescue Exception
warn "Could not load: #{railsrc_path}"
end
end
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Base.clear_reloadable_connections!
ruby-1.9.2-p180 :001 > User.all
User Load (3.0ms) SELECT `users`.* FROM `users`
=> [#<User>, #<User>, #<User>, #<User>, #<User>, #<User>, #<User>]
ruby-1.9.2-p180 :004 > Agency.where(:subdomain => 'bkwld').first
Agency Load (1.4ms) SELECT `agencies`.* FROM `agencies` WHERE (`agencies`.`subdomain` = 'bkwld') LIMIT 1
=> #<Agency id: 1>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment