-
-
Save ketanghumatkar/79db1b685f6822f8df5b to your computer and use it in GitHub Desktop.
Added Client in treeni Data Management : after adding multitenancy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
client = Client.new(name: 'Treeni') | |
client.save! | |
files = Dir["app/models/*.rb"] | |
models = files.map { |file| file.split('/').last.sub(/\.rb/, '').camelize.constantize }.select { |i| i != Client } | |
models.each { |model| model.update_all(client_id: client._id) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment