Class: Compartment::Admin::UsersController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- Compartment::ApplicationController
- ApplicationController
- Compartment::Admin::UsersController
- Defined in:
- app/controllers/compartment/admin/users_controller.rb
Instance Attribute Summary
Attributes inherited from Compartment::ApplicationController
Instance Method Summary collapse
-
#create ⇒ Object
POST /users POST /users.json.
-
#destroy ⇒ Object
DELETE /users/1 DELETE /users/1.json.
-
#edit ⇒ Object
GET /users/1/edit.
-
#index ⇒ Object
GET /users GET /users.json.
-
#new ⇒ Object
GET /users/new GET /users/new.json.
-
#show ⇒ Object
GET /users/1 GET /users/1.json.
-
#update ⇒ Object
PUT /users/1 PUT /users/1.json.
Methods inherited from ApplicationController
Methods inherited from Compartment::ApplicationController
Instance Method Details
#create ⇒ Object
POST /users POST /users.json
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/controllers/compartment/admin/users_controller.rb', line 46 def create @user = User.new(params[:user]) respond_to do |format| if @user.save format.html { redirect_to @user, notice: 'User was successfully created.' } format.json { render json: @user, status: :created, location: @user } else format.html { render action: "new" } format.json { render json: @user.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /users/1 DELETE /users/1.json
78 79 80 81 82 83 84 85 86 |
# File 'app/controllers/compartment/admin/users_controller.rb', line 78 def destroy @user = User.find(params[:id]) @user.destroy respond_to do |format| format.html { redirect_to users_url } format.json { head :no_content } end end |
#edit ⇒ Object
GET /users/1/edit
40 41 42 |
# File 'app/controllers/compartment/admin/users_controller.rb', line 40 def edit @user = User.find(params[:id]) end |
#index ⇒ Object
GET /users GET /users.json
8 9 10 11 12 13 14 15 |
# File 'app/controllers/compartment/admin/users_controller.rb', line 8 def index @users = User.all respond_to do |format| format.html # index.html.erb format.json { render json: @users } end end |
#new ⇒ Object
GET /users/new GET /users/new.json
30 31 32 33 34 35 36 37 |
# File 'app/controllers/compartment/admin/users_controller.rb', line 30 def new @user = User.new respond_to do |format| format.html # new.html.erb format.json { render json: @user } end end |
#show ⇒ Object
GET /users/1 GET /users/1.json
19 20 21 22 23 24 25 26 |
# File 'app/controllers/compartment/admin/users_controller.rb', line 19 def show @user = User.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @user } end end |
#update ⇒ Object
PUT /users/1 PUT /users/1.json
62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'app/controllers/compartment/admin/users_controller.rb', line 62 def update @user = User.find(params[:id]) respond_to do |format| if @user.update_attributes(params[:user]) format.html { redirect_to @user, notice: 'User was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @user.errors, status: :unprocessable_entity } end end end |