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

openSUSE / travel-support-program / 4217239420

pending completion
4217239420

push

github

Unknown Committer
Unknown Commit Message

56 of 56 new or added lines in 3 files covered. (100.0%)

1603 of 1868 relevant lines covered (85.81%)

147.51 hits per line

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

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

3
class BudgetsController < ApplicationController
×
4
  skip_load_resource only: %i[index new]
×
5
  before_action :set_budget, only: %i[show edit update destroy]
×
6

7
  def index
×
8
    @q ||= Budget.accessible_by(current_ability).ransack(params[:q])
×
9
    @q.sorts = 'name asc' if @q.sorts.empty?
×
10
    @index ||= @q.result(distinct: true).page(params[:page]).per(20)
×
11
  end
×
12

13
  def show; end
×
14

15
  def new
×
16
    @budget = Budget.new
×
17
  end
×
18

19
  def create
×
20
    @budget = Budget.new(budget_params)
×
21

22
    respond_to do |format|
×
23
      if @budget.save
×
24
        format.html { redirect_to budget_url(@budget), notice: t(:budget_create) }
×
25
        format.json { render :show, status: :created, location: @budget }
×
26
      else
×
27
        format.html { render :new, status: :unprocessable_entity }
×
28
        format.json { render json: @budget.errors, status: :unprocessable_entity }
×
29
      end
×
30
    end
×
31
  end
×
32

33
  def edit; end
×
34

35
  def update
×
36
    respond_to do |format|
×
37
      if @budget.update(budget_params)
×
38
        format.html { redirect_to budget_url(@budget), notice: t(:budget_update) }
×
39
        format.json { render :show, status: :updated, location: @budget }
×
40
      else
×
41
        format.html { render :new, status: :unprocessable_entity }
×
42
        format.json { render json: @budget.errors, status: :unprocessable_entity }
×
43
      end
×
44
    end
×
45
  end
×
46

47
  def destroy
×
48
    @budget.destroy
×
49

50
    respond_to do |format|
×
51
      format.html { redirect_to budgets_url, notice: t(:budget_destroyed) }
×
52
      format.json { head :no_content }
×
53
    end
×
54
  end
×
55

56
  private
×
57

58
  def set_budget
×
59
    @budget = Budget.find(params[:id])
×
60

61
    redirect_back(fallback_location: budgets_url) unless @budget
×
62
  end
×
63

64
  def budget_params
×
65
    params.require(:budget).permit(:name, :description, :amount, :currency, event_ids: [])
×
66
  end
×
67
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

© 2026 Coveralls, Inc