Skip to content

Instantly share code, notes, and snippets.

@ketanghumatkar
Forked from umar-webonise/add_client.rb
Last active September 15, 2015 11:44
Show Gist options
  • Save ketanghumatkar/79db1b685f6822f8df5b to your computer and use it in GitHub Desktop.
Save ketanghumatkar/79db1b685f6822f8df5b to your computer and use it in GitHub Desktop.
Added Client in treeni Data Management : after adding multitenancy
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