Class: Decidim::RemoveAdmin
- Inherits:
-
Rectify::Command
- Object
- Rectify::Command
- Decidim::RemoveAdmin
- Defined in:
- app/commands/decidim/remove_admin.rb
Overview
A command to remove the admin privilege to an user.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(user) ⇒ RemoveAdmin
constructor
Public: Initializes the command.
Constructor Details
#initialize(user) ⇒ RemoveAdmin
Public: Initializes the command.
form - A form object with the params.
9 10 11 |
# File 'app/commands/decidim/remove_admin.rb', line 9 def initialize(user) @user = user end |
Instance Method Details
#call ⇒ Object
13 14 15 16 17 18 19 |
# File 'app/commands/decidim/remove_admin.rb', line 13 def call return broadcast(:invalid) unless user user.update_attributes!(admin: false) broadcast(:ok) end |