Class: Mks::Rent::OffersController
- Inherits:
-
ApplicationController
- Object
- Auth::ApplicationController
- ApplicationController
- Mks::Rent::OffersController
- Defined in:
- app/controllers/mks/rent/offers_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /offers.
-
#destroy ⇒ Object
DELETE /offers/1.
-
#index ⇒ Object
GET /offers.
-
#show ⇒ Object
GET /offers/1.
-
#update ⇒ Object
PATCH/PUT /offers/1.
Instance Method Details
#create ⇒ Object
POST /offers
20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/mks/rent/offers_controller.rb', line 20 def create @offer = Offer.new(offer_params) if @offer.save render json: @offer, status: :created, location: @offer else render json: @offer.errors, status: :unprocessable_entity end end |
#destroy ⇒ Object
DELETE /offers/1
40 41 42 |
# File 'app/controllers/mks/rent/offers_controller.rb', line 40 def destroy @offer.destroy end |
#index ⇒ Object
GET /offers
8 9 10 11 12 |
# File 'app/controllers/mks/rent/offers_controller.rb', line 8 def index @offers = Offer.all render json: @offers end |
#show ⇒ Object
GET /offers/1
15 16 17 |
# File 'app/controllers/mks/rent/offers_controller.rb', line 15 def show render json: @offer end |
#update ⇒ Object
PATCH/PUT /offers/1
31 32 33 34 35 36 37 |
# File 'app/controllers/mks/rent/offers_controller.rb', line 31 def update if @offer.update(offer_params) render json: @offer else render json: @offer.errors, status: :unprocessable_entity end end |