influitive / apartment

Database multi-tenancy for Rack (and Rails) applications
2.66k stars 464 forks source link

Conflict with model named Apartment #621

Open etewiah opened 4 years ago

etewiah commented 4 years ago

I have a model in my application named Apartment which is obviously creating a conflict. For example when I have "Apartment.all.count" in my code I get this error:

undefined method 'all' for Apartment:Module

Is there some way to rename the Apartment gem or place it in its own namespace? The app I'm working on is a legacy app and the Apartment model is used in too many places for a renaming of that model to work.

gliv commented 4 years ago

You should probably rather attempt to namespace your own classes, however this (hack) may work for you @etewiah https://stackoverflow.com/questions/8449134/equivalent-to-pythons-dynamic-import-statement-in-ruby

etewiah commented 4 years ago

Thanks for the tip @gliv , I'll look into that. Happy 2020!