Skip to content

Instantly share code, notes, and snippets.

@umar-webonise
Last active September 3, 2015 14:10
Show Gist options
  • Save umar-webonise/37ebec077a3d1483ed29 to your computer and use it in GitHub Desktop.
Save umar-webonise/37ebec077a3d1483ed29 to your computer and use it in GitHub Desktop.
Added Client in treeni Data Management
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