Sha256: 712638ca9c40341922a784f306eb1db3ca86f08d5f34e053632a5508aaa0cd70

Contents?: true

Size: 306 Bytes

Versions: 5

Compression:

Stored size: 306 Bytes

Contents

class BoxroomPopulateUserIdInShareLinks < ActiveRecord::Migration[5.0]
  def change
    active_users = Boxroom::User.where.not(:name => nil)

    if active_users.any? && Boxroom::ShareLink.any?
      Boxroom::ShareLink.where(:user_id => nil).update_all(:user_id => active_users.first.id)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
boxroom-0.0.5 db/migrate/20130628082245_boxroom_populate_user_id_in_share_links.rb
boxroom-0.0.4 db/migrate/20130628082245_boxroom_populate_user_id_in_share_links.rb
boxroom-0.0.3 db/migrate/20130628082245_boxroom_populate_user_id_in_share_links.rb
boxroom-0.0.2 db/migrate/20130628082245_boxroom_populate_user_id_in_share_links.rb
boxroom-0.0.1 db/migrate/20130628082245_boxroom_populate_user_id_in_share_links.rb