The code powering m.abunchtell.com https://m.abunchtell.com
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

20190529143559_preserve_old_layout_for_existing_users.rb 580 B

1234567891011121314151617
  1. class PreserveOldLayoutForExistingUsers < ActiveRecord::Migration[5.2]
  2. disable_ddl_transaction!
  3. def up
  4. # Assume that currently active users are already using the layout that they
  5. # want to use, therefore ensure that it is saved explicitly and not based
  6. # on the to-be-changed default
  7. User.where(User.arel_table[:current_sign_in_at].gteq(1.month.ago)).find_each do |user|
  8. next if Setting.unscoped.where(thing_type: 'User', thing_id: user.id, var: 'advanced_layout').exists?
  9. user.settings.advanced_layout = true
  10. end
  11. end
  12. def down
  13. end
  14. end