Class: WidgetsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- WidgetsController
- Defined in:
- app/controllers/widgets_controller.rb
Overview
typed: false
Instance Method Summary collapse
-
#create ⇒ Object
POST /widgets POST /widgets.json.
-
#destroy ⇒ Object
DELETE /widgets/1 DELETE /widgets/1.json.
-
#edit ⇒ Object
GET /widgets/1/edit.
-
#index ⇒ Object
GET /widgets GET /widgets.json.
-
#new ⇒ Object
GET /widgets/new.
-
#show ⇒ Object
GET /widgets/1 GET /widgets/1.json.
-
#update ⇒ Object
PATCH/PUT /widgets/1 PATCH/PUT /widgets/1.json.
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
POST /widgets POST /widgets.json
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'app/controllers/widgets_controller.rb', line 35 def create @widget = Widget.new() respond_to do |format| if @widget.save format.html { redirect_to @widget, notice: 'Widget was successfully created.' } format.json { render :show, status: :created, location: @widget } else format.html { render :new } format.json { render json: @widget.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /widgets/1 DELETE /widgets/1.json
65 66 67 68 69 70 71 |
# File 'app/controllers/widgets_controller.rb', line 65 def destroy @widget.destroy respond_to do |format| format.html { redirect_to , notice: 'Widget was successfully destroyed.' } format.json { head :no_content } end end |
#edit ⇒ Object
GET /widgets/1/edit
30 31 |
# File 'app/controllers/widgets_controller.rb', line 30 def edit end |
#index ⇒ Object
GET /widgets GET /widgets.json
7 8 9 |
# File 'app/controllers/widgets_controller.rb', line 7 def index @widgets = Widget.all end |
#new ⇒ Object
GET /widgets/new
25 26 27 |
# File 'app/controllers/widgets_controller.rb', line 25 def new @widget = Widget.new end |
#show ⇒ Object
GET /widgets/1 GET /widgets/1.json
13 14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/widgets_controller.rb', line 13 def show respond_to do |format| format.html do render 'show' end format.wasm do render 'show' end end end |
#update ⇒ Object
PATCH/PUT /widgets/1 PATCH/PUT /widgets/1.json
51 52 53 54 55 56 57 58 59 60 61 |
# File 'app/controllers/widgets_controller.rb', line 51 def update respond_to do |format| if @widget.update() format.html { redirect_to @widget, notice: 'Widget was successfully updated.' } format.json { render :show, status: :ok, location: @widget } else format.html { render :edit } format.json { render json: @widget.errors, status: :unprocessable_entity } end end end |