Class: Admin::UsersController
- Inherits:
-
BaseController
- Object
- BaseController
- Admin::UsersController
- Defined in:
- app/controllers/admin/users_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/admin/users_controller.rb', line 16 def create @user = User.new(params[:user]) @user.memberships.build(:site => @site) if @site and !@user.admin? if @user.save @user.verify! # TODO hu?? trigger_events(@user) redirect_to [:admin, @user], notice: "The user has been created." else flash.now.alert = "The user could not be created." render :action => :new end end |
#destroy ⇒ Object
43 44 45 46 47 48 49 50 51 |
# File 'app/controllers/admin/users_controller.rb', line 43 def destroy if @user.destroy trigger_events(@user) redirect_to [:admin, :users], notice: "The user has been deleted." else flash.now.alert = "The user could not be deleted." render :action => :edit end end |
#edit ⇒ Object
30 31 |
# File 'app/controllers/admin/users_controller.rb', line 30 def edit end |
#index ⇒ Object
5 6 7 |
# File 'app/controllers/admin/users_controller.rb', line 5 def index @users = User.where(admin: true).to_a + @site.users.to_a end |
#new ⇒ Object
12 13 14 |
# File 'app/controllers/admin/users_controller.rb', line 12 def new @user = User.new end |
#show ⇒ Object
9 10 |
# File 'app/controllers/admin/users_controller.rb', line 9 def show end |
#update ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'app/controllers/admin/users_controller.rb', line 33 def update if @user.update(params[:user]) trigger_events(@user) redirect_to [:admin, @user], notice: "The user has been updated." else flash.now.alert = "The user could not be updated." render :action => :edit end end |