Created
April 9, 2015 16:52
-
-
Save monkbroc/8043063cedfaabde828a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| class CopyTeamUsers < ActiveRecord::Migration | |
| class User < ActiveRecord::Base | |
| has_and_belongs_to_many :teams | |
| has_many :team_user_tmps | |
| has_many :teams_tmp, :through => :team_user_tmps, :source => :team | |
| end | |
| class Team < ActiveRecord::Base | |
| has_and_belongs_to_many :users | |
| has_many :team_user_tmps | |
| has_many :users_tmp, :through => :team_user_tmps, :source => :user | |
| end | |
| class TeamUserTmp < ActiveRecord::Base | |
| belongs_to :team | |
| belongs_to :user | |
| end | |
| def up | |
| Team.find_each do |team| | |
| team.users_tmp = team.users | |
| end | |
| end | |
| def down | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment