app/controllers/programme_items_controller.rb
#
# Drop the given person from all their program items
#
Drop the given person from all their program items
Drop the given person from all their program items
def drop
    if params[:person_id]
      @person = Person.find(params[:person_id])
      @person.programmeItemAssignments.each do |assign|
        progitem = assign.programmeItem
        assign.destroy
        progitem.id_will_change! 
        progitem.save
      end
    end
    render status: :ok, text: {}.to_json
  rescue => ex
    Rails.logger.error ex.message if Rails.env.development?
    Rails.logger.error ex.backtrace.join("\n\t") if Rails.env.development?
    render status: :bad_request, text: ex.message
  end
def drop if params [ :person_id ] @person = Person . find ( params [ :person_id ] ) @person . programmeItemAssignments . each do | assign | progitem = assign . programmeItem assign . destroy progitem . id_will_change! progitem . save end end render status : :ok , text : { } . to_json rescue => ex Rails . logger . error ex . message if Rails . env . development? Rails . logger . error ex . backtrace . join ( "\n\t" ) if Rails . env . development? render status : :bad_request , text : ex . message end
Drop the given person from all their program items
Drop the given person from all their program items
# Remove the person from the programme # NOTE: this will force the update date of the programme item to be changed