Class: Admin::UsersController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::UsersController
- Defined in:
- lib/generators/wradmin/template/controllers/admin/users_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
- #view ⇒ Object
Instance Method Details
#create ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/generators/wradmin/template/controllers/admin/users_controller.rb', line 32 def create @admin_user = Admin::User.new(admin_user_params) if @admin_user.save redirect_to @admin_user, notice: 'User was successfully created.' else render action: 'new' end end |
#destroy ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/generators/wradmin/template/controllers/admin/users_controller.rb', line 53 def destroy @admin_user.destroy respond_to do |format| format.html { redirect_to admin_users_url } format.json { head :no_content } end end |
#edit ⇒ Object
22 23 24 25 26 |
# File 'lib/generators/wradmin/template/controllers/admin/users_controller.rb', line 22 def edit if current_user.autorization == false redirect_to admin_users_path end end |
#index ⇒ Object
7 8 9 |
# File 'lib/generators/wradmin/template/controllers/admin/users_controller.rb', line 7 def index @admin_users = Admin::User.all end |
#new ⇒ Object
15 16 17 18 19 20 |
# File 'lib/generators/wradmin/template/controllers/admin/users_controller.rb', line 15 def new if current_user.autorization == false redirect_to admin_users_path end @admin_user = Admin::User.new end |
#show ⇒ Object
11 12 13 |
# File 'lib/generators/wradmin/template/controllers/admin/users_controller.rb', line 11 def show redirect_to edit_admin_user_path(params[:id]) end |
#update ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/generators/wradmin/template/controllers/admin/users_controller.rb', line 41 def update respond_to do |format| if @admin_user.update(admin_user_params) format.html { redirect_to @admin_user, notice: 'User was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @admin_user.errors, status: :unprocessable_entity } end end end |