Move extra bills to credit cards
This commit is contained in:
parent
c14a408f9a
commit
0887a5f6b9
38 changed files with 242 additions and 251 deletions
70
app/controllers/credit_card_bills_controller.rb
Normal file
70
app/controllers/credit_card_bills_controller.rb
Normal file
|
@ -0,0 +1,70 @@
|
|||
class CreditCardBillsController < ApplicationController
|
||||
before_action :set_credit_card_bill, only: %i[ show edit update destroy ]
|
||||
|
||||
# GET /credit_card_bills or /credit_card_bills.json
|
||||
def index
|
||||
@credit_card_bills = CreditCardBill.all
|
||||
end
|
||||
|
||||
# GET /credit_card_bills/1 or /credit_card_bills/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /credit_card_bills/new
|
||||
def new
|
||||
@credit_card_bill = CreditCardBill.new
|
||||
end
|
||||
|
||||
# GET /credit_card_bills/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /credit_card_bills or /credit_card_bills.json
|
||||
def create
|
||||
@credit_card_bill = CreditCardBill.new(credit_card_bill_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @credit_card_bill.save
|
||||
format.html { redirect_to credit_card_bill_url(@credit_card_bill), notice: "Credit card bill was successfully created." }
|
||||
format.json { render :show, status: :created, location: @credit_card_bill }
|
||||
else
|
||||
format.html { render :new, status: :unprocessable_entity }
|
||||
format.json { render json: @credit_card_bill.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /credit_card_bills/1 or /credit_card_bills/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @credit_card_bill.update(credit_card_bill_params)
|
||||
format.html { redirect_to credit_card_bill_url(@credit_card_bill), notice: "Credit card bill was successfully updated." }
|
||||
format.json { render :show, status: :ok, location: @credit_card_bill }
|
||||
else
|
||||
format.html { render :edit, status: :unprocessable_entity }
|
||||
format.json { render json: @credit_card_bill.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /credit_card_bills/1 or /credit_card_bills/1.json
|
||||
def destroy
|
||||
@credit_card_bill.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to credit_card_bills_url, notice: "Credit card bill was successfully destroyed." }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_credit_card_bill
|
||||
@credit_card_bill = CreditCardBill.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def credit_card_bill_params
|
||||
params.require(:credit_card_bill).permit(:description, :amount)
|
||||
end
|
||||
end
|
|
@ -65,6 +65,6 @@ class ExpensesController < ApplicationController
|
|||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def expense_params
|
||||
params.require(:expense).permit(:description, :payment, :period, :autopaid, :estimated)
|
||||
params.require(:expense).permit(:description, :payment, :period, :credit_card, :estimated)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
class ExtraBillsController < ApplicationController
|
||||
before_action :set_extra_bill, only: %i[ show edit update destroy ]
|
||||
|
||||
# GET /extra_bills or /extra_bills.json
|
||||
def index
|
||||
@extra_bills = ExtraBill.all
|
||||
end
|
||||
|
||||
# GET /extra_bills/1 or /extra_bills/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /extra_bills/new
|
||||
def new
|
||||
@extra_bill = ExtraBill.new
|
||||
end
|
||||
|
||||
# GET /extra_bills/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /extra_bills or /extra_bills.json
|
||||
def create
|
||||
@extra_bill = ExtraBill.new(extra_bill_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @extra_bill.save
|
||||
format.html { redirect_to extra_bill_url(@extra_bill), notice: "Extra bill was successfully created." }
|
||||
format.json { render :show, status: :created, location: @extra_bill }
|
||||
else
|
||||
format.html { render :new, status: :unprocessable_entity }
|
||||
format.json { render json: @extra_bill.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /extra_bills/1 or /extra_bills/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @extra_bill.update(extra_bill_params)
|
||||
format.html { redirect_to extra_bill_url(@extra_bill), notice: "Extra bill was successfully updated." }
|
||||
format.json { render :show, status: :ok, location: @extra_bill }
|
||||
else
|
||||
format.html { render :edit, status: :unprocessable_entity }
|
||||
format.json { render json: @extra_bill.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /extra_bills/1 or /extra_bills/1.json
|
||||
def destroy
|
||||
@extra_bill.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to extra_bills_url, notice: "Extra bill was successfully destroyed." }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_extra_bill
|
||||
@extra_bill = ExtraBill.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def extra_bill_params
|
||||
params.require(:extra_bill).permit(:description, :amount, :deduct_autopaid)
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue