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

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -