I have the following edit action:
As you can see below, the edit action will check whether the record in question has properties such as a
destination_location, and if not, render a view that let’s the user set a
def edit add_rig_checklist_breadcrumb @rig_checklist = InvProcure::RigChecklist.find(params[:id]) if @rig_checklist.destination_location.nil? || params[:view] == "select_rig" @rigs = current_customer.locations.where(location_type: "Vehicle") return render "select_rig" end if @rig_checklist.fulfilling_location.nil? || params[:view] == "select_fulfilling_location" @fulfill_locations = current_customer.locations.where(location_type: "Building") return render "select_fulfilling_location" end if params[:view] == "scan_compartment" return render "scan_compartment" end if params[:view] == "manual_select_compartment" @compartments = @rig_checklist.destination_location.sublocations return render "manual_select_compartment" end if session[:compartment_id].nil? return render "prompt_compartment" end end
My thinking is in trying to keep with RESTful design, but this controller action is starting to look unwieldy. Is what I currently have bad design?
Wondering how I might be able to clean this up, while also keep in line with RESTful principles.