Created
September 14, 2011 19:40
-
-
Save gregoriokusowski/1217555 to your computer and use it in GitHub Desktop.
A stupid script that may be used a single time to migrate an old data-base to one of those new rails multi-tenancy(scoped) apps. It's not pretty. Not even safe, so watchout =P
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
%x[ls -R app/models/].split("\n").each do |w| | |
begin | |
w[0...-3].camelize.constantize.unscoped.each{ |u| u.update_attribute(:company_id, Company.unscoped.first.id) } | |
rescue | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment