Class: ChainsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- ChainsController
- Defined in:
- app/controllers/chains_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /chains or /chains.json.
-
#destroy ⇒ Object
DELETE /chains/1 or /chains/1.json.
-
#edit ⇒ Object
GET /chains/1/edit.
-
#index ⇒ Object
GET /chains or /chains.json.
-
#new ⇒ Object
GET /chains/new.
-
#show ⇒ Object
GET /chains/1 or /chains/1.json.
-
#update ⇒ Object
PATCH/PUT /chains/1 or /chains/1.json.
Methods inherited from ApplicationController
#home, #mining_profile, #privacy_policy, #terms
Instance Method Details
#create ⇒ Object
POST /chains or /chains.json
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/chains_controller.rb', line 25 def create @chain = Chain.new(chain_params) respond_to do |format| if @chain.save format.html { redirect_to chain_url(@chain), notice: "Chain was successfully created." } format.json { render :show, status: :created, location: @chain } else format.html { render :new, status: :unprocessable_entity } format.json { render json: @chain.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /chains/1 or /chains/1.json
53 54 55 56 57 58 59 60 |
# File 'app/controllers/chains_controller.rb', line 53 def destroy @chain.destroy respond_to do |format| format.html { redirect_to chains_url, notice: "Chain was successfully destroyed." } format.json { head :no_content } end end |
#edit ⇒ Object
GET /chains/1/edit
21 22 |
# File 'app/controllers/chains_controller.rb', line 21 def edit end |
#index ⇒ Object
GET /chains or /chains.json
7 8 9 |
# File 'app/controllers/chains_controller.rb', line 7 def index @chains = Chain.all end |
#new ⇒ Object
GET /chains/new
16 17 18 |
# File 'app/controllers/chains_controller.rb', line 16 def new @chain = Chain.new end |
#show ⇒ Object
GET /chains/1 or /chains/1.json
12 13 |
# File 'app/controllers/chains_controller.rb', line 12 def show end |
#update ⇒ Object
PATCH/PUT /chains/1 or /chains/1.json
40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/controllers/chains_controller.rb', line 40 def update respond_to do |format| if @chain.update(chain_params) format.html { redirect_to chain_url(@chain), notice: "Chain was successfully updated." } format.json { render :show, status: :ok, location: @chain } else format.html { render :edit, status: :unprocessable_entity } format.json { render json: @chain.errors, status: :unprocessable_entity } end end end |