Inital update for redmine 4.0+ compatibility

This commit is contained in:
2022-02-01 20:53:20 -05:00
parent 4b34852c72
commit 7cc8a946fd
21 changed files with 94 additions and 166 deletions

View File

@@ -1,6 +1,6 @@
#The MIT License (MIT)
#
#Copyright (c) 2017 rick barrette
#Copyright (c) 2022 rick barrette
#
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
@@ -14,7 +14,11 @@ class VehiclesController < ApplicationController
include AuthHelper
before_filter :require_user
before_action :require_user
def allowed_params
params.require(:vehicle).permit(:year, :make, :model, :customer_id, :notes, :vin)
end
# display a list of all vehicles
def index
@@ -43,7 +47,7 @@ class VehiclesController < ApplicationController
# create a new vehicle
def create
@vehicle = Vehicle.new(params[:vehicle])
@vehicle = Vehicle.new(allowed_params)
if @vehicle.save
flash[:notice] = "New Vehicle Created"
redirect_to @vehicle
@@ -78,7 +82,7 @@ class VehiclesController < ApplicationController
@customer = params[:customer]
begin
@vehicle = Vehicle.find_by_id(params[:id])
if @vehicle.update_attributes(params[:vehicle])
if @vehicle.update_attributes(allowed_params)
flash[:notice] = "Vehicle updated"
redirect_to @vehicle
else
@@ -117,4 +121,4 @@ class VehiclesController < ApplicationController
found_non_zero
end
end
end