You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: seasons_controller.rb
    path of file: ./repos/SalorHospitality/salor-hospitality/app/controllers
    
    the code of the file until where you have to start completion: # Copyright (c) 2012 Red (E) Tools Ltd.
#
# 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
    
  def update
    @season = Season.accessible_by(@current_user).existing.find_by_id(params[:id])
    redirect_to seasons_path and return unless @season
    permitted = params.require(:season).permit :name,
      :'from_date(1i)',
      :'from_date(2i)',
      :'from_date(3i)',
      :'to_date(1i)',
      :'to_date(2i)',
      :'to_date(3i)',
      :color
    if @season.update_attributes permitted
      @season.calculate_duration
      redirect_to(seasons_path)
    else
      render(:new)
    end