Class: GearsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- GearsController
- Defined in:
- app/controllers/gears_controller.rb
Overview
This is the controller for Gear.
Instance Method Summary collapse
-
#create ⇒ Object
POST /gears POST /gears.json.
-
#destroy ⇒ Object
DELETE /gears/1 DELETE /gears/1.json.
-
#edit ⇒ Object
GET /gears/1/edit.
-
#index ⇒ Object
GET /gears GET /gears.json.
-
#new ⇒ Object
GET /gears/new.
-
#show ⇒ Object
GET /gears/1 GET /gears/1.json.
-
#update ⇒ Object
PATCH/PUT /gears/1 PATCH/PUT /gears/1.json.
Methods inherited from ApplicationController
#check_for_mobile, #mobile_device?
Instance Method Details
#create ⇒ Object
POST /gears POST /gears.json
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/controllers/gears_controller.rb', line 29 def create @gear = Gear.new(gear_params) @gear respond_to do |format| if @gear.save format.html { redirect_to @gear, notice: 'Gear was successfully created.' } format.json { render :show, status: :created, location: @gear } else format.html { render :new } format.json { render json: @gear.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /gears/1 DELETE /gears/1.json
59 60 61 62 63 64 65 |
# File 'app/controllers/gears_controller.rb', line 59 def destroy @gear.destroy respond_to do |format| format.html { redirect_to gears_url, notice: 'Gear was successfully destroyed.' } format.json { head :no_content } end end |
#edit ⇒ Object
GET /gears/1/edit
25 |
# File 'app/controllers/gears_controller.rb', line 25 def edit; end |
#index ⇒ Object
GET /gears GET /gears.json
9 10 11 12 |
# File 'app/controllers/gears_controller.rb', line 9 def index @hunter = Hunter.find(params[:hunter_id]) if params[:hunter_id] @gears = Gear.all end |
#new ⇒ Object
GET /gears/new
19 20 21 22 |
# File 'app/controllers/gears_controller.rb', line 19 def new @gear = Gear.new @gear end |
#show ⇒ Object
GET /gears/1 GET /gears/1.json
16 |
# File 'app/controllers/gears_controller.rb', line 16 def show; end |
#update ⇒ Object
PATCH/PUT /gears/1 PATCH/PUT /gears/1.json
45 46 47 48 49 50 51 52 53 54 55 |
# File 'app/controllers/gears_controller.rb', line 45 def update respond_to do |format| if @gear.update(gear_params) format.html { redirect_to @gear, notice: 'Gear was successfully updated.' } format.json { render :show, status: :ok, location: @gear } else format.html { render :edit } format.json { render json: @gear.errors, status: :unprocessable_entity } end end end |