• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

sleede / fab-manager / #106

pending completion
#106

push

coveralls-ruby

sylvainbx
Merge branch 'dev' for release 6.0.0

704 of 704 new or added lines in 168 files covered. (100.0%)

7919 of 13474 relevant lines covered (58.77%)

15.29 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/app/controllers/api/custom_assets_controller.rb
1
# frozen_string_literal: true
2

3
# API Controller for resources of type CustomAsset
4
# CustomAssets are used in settings
5
class API::CustomAssetsController < API::APIController
×
6
  before_action :authenticate_user!, only: %i[update create]
×
7
  before_action :set_custom_asset, only: %i[show update]
×
8

9
  # PUT /api/custom_assets/1/
10
  def update
×
11
    authorize CustomAsset
×
12
    if @custom_asset.update(custom_asset_params.permit!)
×
13
      render :show, status: :ok, location: @custom_asset
×
14
    else
×
15
      render json: @custom_asset.errors, status: :unprocessable_entity
×
16
    end
×
17
  end
×
18

19
  # POST /api/custom_assets/
20
  def create
×
21
    authorize CustomAsset
×
22
    @custom_asset = CustomAsset.new(custom_asset_params.permit!)
×
23
    if @custom_asset.save
×
24
      render :show, status: :created, location: @custom_asset
×
25
    else
×
26
      render json: @custom_asset.errors, status: :unprocessable_entity
×
27
    end
×
28
  end
×
29

30
  # GET /api/custom_assets/1/
31
  def show; end
×
32

33
  private
×
34

35
  def set_custom_asset
×
36
    @custom_asset = CustomAsset.find_by(name: params[:id])
×
37
  end
×
38

39
  # Never trust parameters from the scary internet, only allow the white list through.
40
  def custom_asset_params
×
41
    params.required(:custom_asset).permit(:name, custom_asset_file_attributes: [:attachment])
×
42
  end
×
43
end
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc