Method: PassTypesController#destroy

Defined in:
app/controllers/pass_types_controller.rb

#destroyObject



36
37
38
39
40
41
42
43
44
45
# File 'app/controllers/pass_types_controller.rb', line 36

def destroy
  @pass_type = current_user.current_organization.pass_types.where(:id => params[:id]).first
  if @pass_type.destroyable?
    @pass_type.destroy
    flash[:notice] = "We've deleted this pass type"
  else
    flash[:error] = "Can't delete this pass type because you've sold some passes for this type."
  end
  redirect_to pass_types_path
end