Add update method to GridSummonsController
This commit is contained in:
parent
bb79f68a2c
commit
8c1fae02d4
2 changed files with 10 additions and 2 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
module Api
|
module Api
|
||||||
module V1
|
module V1
|
||||||
class GridSummonsController < Api::V1::ApiController
|
class GridSummonsController < Api::V1::ApiController
|
||||||
before_action :set, only: %w[destroy]
|
before_action :set, only: %w[update destroy]
|
||||||
|
|
||||||
attr_reader :party, :incoming_summon
|
attr_reader :party, :incoming_summon
|
||||||
|
|
||||||
|
|
@ -24,6 +24,14 @@ module Api
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
@summon.attributes = summon_params
|
||||||
|
|
||||||
|
return render json: GridSummonBlueprint.render(@summon, view: :full) if @summon.save
|
||||||
|
|
||||||
|
render_validation_error_response(@character)
|
||||||
|
end
|
||||||
|
|
||||||
def save_summon(summon)
|
def save_summon(summon)
|
||||||
if (grid_summon = GridSummon.where(
|
if (grid_summon = GridSummon.where(
|
||||||
party_id: party.id,
|
party_id: party.id,
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ Rails.application.routes.draw do
|
||||||
resources :users, only: %i[create update show]
|
resources :users, only: %i[create update show]
|
||||||
resources :grid_weapons, only: %i[update destroy]
|
resources :grid_weapons, only: %i[update destroy]
|
||||||
resources :grid_characters, only: %i[update destroy]
|
resources :grid_characters, only: %i[update destroy]
|
||||||
resources :grid_summons, only: %i[destroy]
|
resources :grid_summons, only: %i[update destroy]
|
||||||
resources :favorites, only: [:create]
|
resources :favorites, only: [:create]
|
||||||
|
|
||||||
get 'users/info/:id', to: 'users#info'
|
get 'users/info/:id', to: 'users#info'
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue