Skip to content

Detectify is a gem for multi-tenant Rack apps, to help you retrieve domain and subdomain-related data from a database.

License

Notifications You must be signed in to change notification settings

rubygarage/detectify

Repository files navigation

Detectify

Gem Version Code Climate Coverage Status Build Status

Detectify provides a simple way to retrieve an ActiveRecord entity based on the domain/subdomain request information.

It’s a Ruby gem, similar to Houser, that helps you retrieve an Active Record entity from a database with a URL. You know Houser is a multi-tenancy gem that can send database requests using subdomain names. But Houser is a relatively old Ruby library. For modern Rails-based SaaS apps, we wanted more flexibility. That's why we've developed Detectify. For more information, you can read here Detectify review.

Installation

Add this line to your application's Gemfile:

gem 'detectify', github: 'rubygarage/detectify'

and then execute: $ bundle

Finally, restart the server to apply the changes.

Detectify only supports applications built with Ruby 2.2.2 and Rails 4.2 or higher.

Usage

Start off by generating an initializer:

$ bundle exec rails g detectify:install

this will create file config/initializers/detectify.rb in your application directory.

You can configure Detectify for your application needs via initializer. After this you can access detected entity via: request.env['Detectify-Entity'].

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/rubygarage/detectify. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.


RubyGarage Logo

RubyGarage is a leading software development and consulting company in Eastern Europe. Our main expertise includes Ruby and Ruby on Rails, but we successfully employ other technologies to deliver the best results to our clients. Check out our portfolio for even more exciting works!