What is the relevance of your most_puddles_count
method? Do you need a whole method for this? most_puddles_count
Can refactor your driver_info
method. driver_info
def driver_info
[driver_name, driver_address, driver_phone]
end
Very well done on all of the validations! These are very cleanly written and cover numerous user use cases.
You don't need to repeat your before_action :authorize_user
in each controller because you are already calling it in the ApplicationController
. Just like you did in the SessionsController
use the skip_before_action :authorize_user, only: [:new, :create]
to not have that method run in certain controllers.
You're repeating a lot of .find()
calls in your controllers. These can all be moved to a private method that is defined once, but called numerous times. For example in your CarsController
you call @car = Car.find(params[:id])
a few times. Instead:
class CarsController < ApplicationController
before_action :set_car, only: [:action1, :action2]
...
private
def set_car
@car = Car.find(params[:id])
end
end
Try to stick with RESTful routing and the proper CRUD actions! DriversController. This Uuuuugly - This should be an update action with the proper URL routing to go along with it i.e. patch '/drivers/:id', to: 'drivers#update', as: 'driver_remove_passenger'
OR handle this update in your puddles#update
action with the logic moved to your model.
Love all of the partials. These are incredibly useful and make life easier for a programmer trying to read your code.
Be sure you focus on proper RESTful routing and CRUD actions. If you think you need a new action for your app 9/10 times that will not be the case and that logic can be put into a proper CRUD action. Overall this turned out great! You should all be very proud of the hard work you put in. @Franco83-2 @joesass @Joll59