# File app/controllers/conferences_controller.rb, line 83
  def unregister
    registrations_sanity_checks or return false

    # Avoid silly mistakes due to reloads
    return unless @user.conferences.include? @conference

    if props = @conference.proposals_by_person(@user) and
        !props.empty?
      flash[:error] << _('You have %d proposals registered for this ' +
                         'conference. Please withdraw them before ' +
                         'unregistering.') % props.size
      return false
    end

    if @user.conferences.delete @conference
      flash[:notice] << _('You have successfully unregistered from ' +
                          'conference "%s"') % @conference.name
    else
      flash[:error] << _('Could not unregister you from conference %s: %s') %
        [@conference.name, @user.errors.full_messages]
    end
  end