Sha256: 9f01ae6626c6f2d00d8bd47df64fa553a63f5310aee1da7ab96cad47c8d9617d

Contents?: true

Size: 385 Bytes

Versions: 7

Compression:

Stored size: 385 Bytes

Contents

# frozen_string_literal: true

class AddNicknameToManagedUsers < ActiveRecord::Migration[5.2]
  class User < ApplicationRecord
    self.table_name = :decidim_users
  end

  def up
    User.where(managed: true, nickname: nil).includes(:organization).find_each do |user|
      user.nickname = User.nicknamize(user.name, organization: user.organization)
      user.save
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
decidim-core-0.15.2 db/migrate/20180706104107_add_nickname_to_managed_users.rb
decidim-core-0.15.1 db/migrate/20180706104107_add_nickname_to_managed_users.rb
decidim-core-0.15.0 db/migrate/20180706104107_add_nickname_to_managed_users.rb
decidim-core-0.14.4 db/migrate/20180706104107_add_nickname_to_managed_users.rb
decidim-core-0.14.3 db/migrate/20180706104107_add_nickname_to_managed_users.rb
decidim-core-0.14.2 db/migrate/20180706104107_add_nickname_to_managed_users.rb
decidim-core-0.14.1 db/migrate/20180706104107_add_nickname_to_managed_users.rb