Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions GoBug/app/controllers/expenses_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require 'pry'
class ExpensesController < ApplicationController
before_action :set_expense, only: [:show, :edit, :update, :destroy]
before_action :set_trip, only: [:new, :create]
Expand Down Expand Up @@ -57,10 +58,9 @@ def update
# DELETE /expenses/1
# DELETE /expenses/1.json
def destroy
@leg = @expense.leg
@expense.destroy
respond_to do |format|
format.html { redirect_to leg_expenses_path(@leg), notice: 'Expense was successfully destroyed.' }
format.html { redirect_to expenses_path, notice: 'Expense was successfully destroyed.' }
format.json { head :no_content }
end
end
Expand Down
2 changes: 1 addition & 1 deletion GoBug/app/controllers/trips_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,6 @@ def set_trip

# Never trust parameters from the scary internet, only allow the white list through.
def trip_params
params.require(:trip).permit(:name, :description, :budget, :is_published, :is_private, expenses_attributes: [:location_id, :cost, :description, :category_id, :date])
params.require(:trip).permit(:name, :description, :budget, :is_published, :is_private)
end
end