Class: ProfilesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- ProfilesController
- Defined in:
- app/controllers/profiles_controller.rb
Instance Method Summary collapse
-
#destroy ⇒ Object
DELETE /users/1 DELETE /users/1.json.
-
#edit ⇒ Object
GET /users/1/edit.
-
#show ⇒ Object
GET /users/1 GET /users/1.json.
-
#update ⇒ Object
PATCH/PUT /users/1 PATCH/PUT /users/1.json.
Instance Method Details
#destroy ⇒ Object
DELETE /users/1 DELETE /users/1.json
32 33 34 35 36 37 38 |
# File 'app/controllers/profiles_controller.rb', line 32 def destroy @user.destroy respond_to do |format| format.html { redirect_to root_url, notice: 'User was successfully destroyed.' } format.json { head :no_content } end end |
#edit ⇒ Object
GET /users/1/edit
13 14 |
# File 'app/controllers/profiles_controller.rb', line 13 def edit end |
#show ⇒ Object
GET /users/1 GET /users/1.json
6 7 8 9 10 |
# File 'app/controllers/profiles_controller.rb', line 6 def show @user = User.find_by(name: params[:username]) @observes = @user.observe_users @observed = @user.observed_users end |
#update ⇒ Object
PATCH/PUT /users/1 PATCH/PUT /users/1.json
18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/profiles_controller.rb', line 18 def update respond_to do |format| if @user.update(user_params) format.html { redirect_to root_url, notice: 'User was successfully updated.' } format.json { render :show, status: :ok, location: @user } else format.html { render :edit } format.json { render json: @user.errors, status: :unprocessable_entity } end end end |