title: Using ActiveRecord models from Rails app in a Sinatra app produces multiple warnings
body: <p>We are using Sinatra to provide HTTP API access to our service, while most of the user-facing functionality uses Rails 2.3.8. Both the Sinatra and the Rails application share the same ActiveRecord models, defined in the RAILS_ROOT/app/models directory.</p>
  
  <p>In an setup script for the Sinatra application, all of the models are loaded using <code>ActiveSupport::Dependencies</code> and the database connection is initialized:</p>
  
  <pre><code>require 'active_support'
  relative_load_paths = %w(app/models)
  ::ActiveSupport::Dependencies.load_paths = relative_load_paths.map { |path|
    File.expand_path(path, RAILS_ROOT)
  }
  
  require 'active_record'
  config_path     = File.expand_path('config/database.yml', RAILS_ROOT)
  all_envs_config = YAML.load(File.read(config_path)) 
  config          = all_envs_config[env.to_s]
  ::ActiveRecord::Base.establish_connection(config)
  </code></pre>
  
  <p>The above alone does not produce any warnings, but whenever any of our models is used from the API side (e.g. in tests), multiple warnings will be output to the console:</p>
  
  <pre><code>/path/to/ruby/gems/activesupport-2.3.8/lib/active_support/vendor.rb:32: warning: redefine normalize_translation_keys
  /path/to/ruby/gems/activerecord-2.3.8/lib/active_record/validations.rb:393: warning: `*' interpreted as argument prefix
  /path/to/ruby/gems/activerecord-2.3.8/lib/active_record/validations.rb:29: warning: method redefined; discarding old message
  /path/to/ruby/gems/activerecord-2.3.8/lib/active_record/dirty.rb:40: warning: `*' interpreted as argument prefix
  /path/to/ruby/gems/activerecord-2.3.8/lib/active_record/callbacks.rb:228: warning: `*' interpreted as argument prefix
  /path/to/ruby/gems/sinatra-1.2.0/lib/sinatra/base.rb:1096: warning: method redefined; discarding old options
  /path/to/ruby/gems/shoulda-2.10.3/lib/shoulda/context.rb:4: warning: method redefined; discarding old contexts
  /path/to/ruby/gems/shoulda-2.10.3/lib/shoulda/context.rb:330: warning: method redefined; discarding old subject_block
  /path/to/ruby/gems/shoulda-2.10.3/lib/shoulda/proc_extensions.rb:4: warning: method redefined; discarding old bind
  /path/to/ruby/gems/actionpack-2.3.8/lib/action_controller/integration.rb:99: warning: `*' interpreted as argument prefix
  /path/to/ruby/gems/actionpack-2.3.8/lib/action_controller/test_process.rb:90: warning: method redefined; discarding old path
  /path/to/ruby/gems/actionpack-2.3.8/lib/action_controller/test_process.rb:397: warning: method redefined; discarding old get
  /path/to/ruby/gems/actionpack-2.3.8/lib/action_controller/test_process.rb:402: warning: method redefined; discarding old post
  /path/to/ruby/gems/actionpack-2.3.8/lib/action_controller/test_process.rb:407: warning: method redefined; discarding old put
  /path/to/ruby/gems/actionpack-2.3.8/lib/action_controller/test_process.rb:412: warning: method redefined; discarding old delete
  /path/to/ruby/gems/actionpack-2.3.8/lib/action_controller/test_process.rb:417: warning: method redefined; discarding old head
  /path/to/ruby/gems/activerecord-2.3.8/lib/active_record/reflection.rb:261: warning: instance variable @collection not initialized
  /path/to/ruby/gems/activerecord-2.3.8/lib/active_record/reflection.rb:261: warning: instance variable @collection not initialized
  /path/to/ruby/gems/activerecord-2.3.8/lib/active_record/reflection.rb:261: warning: instance variable @collection not initialized
  ...
  </code></pre>
  
  <p>Is this because of our use of ActiveSupport::Dependencies to automatically load the models whenever needed, or is there something else in the setup script above that might be causing this behavior?</p>