admin_users.rb 437 B

1234567891011121314151617181920212223242526
  1. ActiveAdmin.register AdminUser do
  2. menu :priority => 999
  3. before_destroy :raise_if_last
  4. def raise_if_last
  5. if AdminUser.count < 2
  6. raise "Can't delete last admin user"
  7. end
  8. end
  9. index do
  10. column :email
  11. column :current_sign_in_at
  12. column :last_sign_in_at
  13. column :sign_in_count
  14. default_actions
  15. end
  16. form do |f|
  17. f.inputs "Admin Details" do
  18. f.input :email
  19. end
  20. f.buttons
  21. end
  22. end