The code powering m.abunchtell.com https://m.abunchtell.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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