Ruby on Rails: Devise Gem Admin customization -
how can run code link or button in haml:
current_user.update_attribute :admin, true
i trying make there section of site make 1 admin. part of making admin accounts in devise wiki have.
probably easiest thing create checkbox on edit user form, corresponds admin boolean model field. then, when update action saves user record, update attribute virtue of field being included in form:
-form_for @user |f| %p = f.label :admin %br = f.check_box :admin
naturally, need restrict access update user form in manner, admins can see it. separate issue, however. hope helps!
Comments
Post a Comment