ActiveConnection
ActiveConnection is a simple wrapper around ActiveRecord::Base.connection.schema_search_path.
Installation
Add this line to your application's Gemfile:
gem 'active_connection'
And then execute:
$ bundle
Usage
Useful in multi-tenant situations where you have a user table in the public schema and a separate schema for each tenants data.
ActiveConnection.schema_search_path('other_schema', 'public') do
# Do something that depends on other_schema
end
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request