Class: Maglev::Api::AssetsController
- Inherits:
-
Maglev::ApiController
- Object
- ApplicationController
- Maglev::ApplicationController
- Maglev::ApiController
- Maglev::Api::AssetsController
- Includes:
- ActiveStorage::SetCurrent
- Defined in:
- app/controllers/maglev/api/assets_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
18 19 20 21 |
# File 'app/controllers/maglev/api/assets_controller.rb', line 18 def create asset = resources.create!(asset_params) head :created, location: api_asset_path(asset), maglev_asset_id: asset.id end |
#destroy ⇒ Object
28 29 30 31 |
# File 'app/controllers/maglev/api/assets_controller.rb', line 28 def destroy resources.find(params[:id]).destroy! head :no_content end |
#index ⇒ Object
8 9 10 11 12 |
# File 'app/controllers/maglev/api/assets_controller.rb', line 8 def index @assets = resources.search( params[:query], params[:asset_type], params[:page], params[:per_page] ) end |
#show ⇒ Object
14 15 16 |
# File 'app/controllers/maglev/api/assets_controller.rb', line 14 def show @asset = resources.find(params[:id]) end |
#update ⇒ Object
23 24 25 26 |
# File 'app/controllers/maglev/api/assets_controller.rb', line 23 def update resources.find(params[:id]).update!(asset_params) head :ok end |