Giter Site home page Giter Site logo

excid3 / acts_as_tenant Goto Github PK

View Code? Open in Web Editor NEW

This project forked from erwinm/acts_as_tenant

21.0 21.0 1.0 381 KB

Easy multi-tenancy for Rails in a shared database setup.

License: MIT License

Ruby 90.00% JavaScript 1.12% CSS 1.04% HTML 7.84%

acts_as_tenant's Introduction

๐Ÿ‘‹ I'm a Ruby and Rails developer building things for the community.

๐Ÿ’ป Here's a few of the projects I'm working on:

  • GoRails - Screencasts for Ruby on Rails developers
  • Jumpstart - A complete Ruby on Rails SaaS template
  • Hatchbox - Hosting for Ruby and Rails apps
  • RailsBytes - Reusable templates for adding features to Ruby on Rails apps
  • Rails Hackathon - A weekend hackathon for Ruby on Rails developers to get together and build their ideas.
  • Pay - A complete payments engine for Ruby on Rails apps
  • Noticed - Notifications system for Ruby on Rails apps
  • ActsAsTenant - Multitenancy for Ruby on Rails apps
  • A bunch of other Ruby gems

โœจ You can follow me on Twitter @excid3

If you like my work and want me to be able to keep improving it, please sponsor me on GitHub.

acts_as_tenant's People

Contributors

aaronrenner avatar agrare avatar artplan1 avatar calebhearth avatar davekaro avatar dsarhadian avatar duboff avatar erwinm avatar excid3 avatar girasquid avatar hypomodern avatar iangreenleaf avatar laurens avatar ludamillion avatar marceloalves avatar maslenkov avatar mehdik avatar mylesboone avatar niborg avatar olleolleolle avatar pavloo avatar pcragone avatar petergoldstein avatar phfts avatar preth00nker avatar rtdp avatar shiroginne avatar stgeneral avatar tmaier avatar yshmarov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

brandoncordell

acts_as_tenant's Issues

Relationship cache causes unexpected behaviour

Hi @excid3, thanks for forking it and taking a stab on maintaining acts_as_tenant.

I introduced tenancy to an app early this year and have encountered unexpected behaviour due to this override:

https://github.com/excid3/acts_as_tenant/blob/master/lib/acts_as_tenant/model_extensions.rb#L177-L183

The gains are negligible, less than 0.5ms, and ActiveRecord caches that if we're calling the tenant object over and over with the same object.

If the tenant object changed/updated underneath between when it was first loaded to when the association is called, it causes to return a stale object. That's pretty much what I've hit a few times until forking and dropping these lines: https://github.com/fivegoodfriends/acts_as_tenant/commit/33ac6cfee2e339f3883cdd945e0df00297ff959d

By letting belongs_to work as intended, it hits the db, taking less than 0.5ms, and AR caches it for free after that.

At the time I wrote the initial issue at ErwinM's repo, I didn't find the reason behind the caching through looking commit history.

Is there a real need for it you may be aware of?
Would you consider accepting a PR that drops it?
I'd be happy to do the work.

I appreciate your help and time.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.