app/controllers/punch_clock_sets_controller.rb
def destroy
    @punch_clock_set = PunchClockSet.find(params[:id])
    @punch_clock_set.punch_clocks.each {|clock| clock.destroy}
    @punch_clock_set.destroy
    redirect_to(punch_clock_sets_url)
  end
# Should be refactored to use dependent: :destroy, but unsure if that works when
# the presence of the parent is optional.  Must investigate.  -ben
Should be refactored to use dependent: :destroy, but unsure if that works when
the presence of the parent is optional.  Must investigate.  -ben
Should be refactored to use dependent : : destroy but unsure if that works when the presence of the parent is optional . Must investigate . - ben
def destroy
    @punch_clock_set = PunchClockSet.find(params[:id])
    @punch_clock_set.punch_clocks.each {|clock| clock.destroy}
    @punch_clock_set.destroy
    redirect_to(punch_clock_sets_url)
  end
def destroy @punch_clock_set = PunchClockSet . find ( params [ :id ] ) @punch_clock_set . punch_clocks . each { | clock | clock . destroy } @punch_clock_set . destroy redirect_to ( punch_clock_sets_url ) end
Should be refactored to use dependent: :destroy, but unsure if that works when
the presence of the parent is optional.
Should be refactored to use dependent : : destroy but unsure if that works when the presence of the parent is optional .